Function Reference
Convert
Convert a measurement from one set of units to another.
Syntax:
wwunits:Convert($sourceValue, $sourceUnits, $targetUnits)
Parameters:
Name
Type
Description
sourceValue
double
Source value.
sourceUnits
string
Source units.
targetUnits
string
Target units.
Returns:
double: A number.
Example:

<xsl:variable name="VarCentimeters" select="wwunits:Convert(wwunits:NumericPrefix('2in'), wwunits:UnitsSuffix('2in'), 'cm')" />

CSSRGBColor
Convert the given HTML/CSS color to a hex encoded CSS color. Useful for converting named colors such as green to their hex equivalents.
Syntax:
wwunits:CSSRGBColor($htmlColor)
Parameters:
Name
Type
Description
htmlColor
string
The HTML color.
Returns:
string: Hex encoded CSS color as string.
Example:

<xsl:variable name="VarGreenAsRGB" select="wwunits:CSSRGBColor('green')" />

EncodingFromCodePage
Determine the HTML encoding for a page given a Windows code page value.
Syntax:
wwunits:EncodingFromCodePage($codePage)
Parameters:
Name
Type
Description
codePage
int
The code page.
Returns:
string: A string.
Example:

<xsl:variable name="VarEncoding" select="wwunits:EncodingFromCodePage(23)" />

NumericPrefix
Extract the numeric prefix of 'value'.
Syntax:
wwunits:NumericPrefix($value)
Parameters:
Name
Type
Description
value
string
The value.
Returns:
string: A string.
Example:

<xsl:variable name="VarNumber" select="wwunits:NumericPrefix('24px')" />

RTFColor
Convert a standard HTML/CSS color to an RTF color.
Syntax:
wwunits:RTFColor($htmlColor)
Parameters:
Name
Type
Description
htmlColor
string
The HTML color.
Returns:
string: RTF color as string.
Example:

<xsl:varaible name="VarRTFColor" select="wwunits:RTFColor('#FF3399')" />

UnitsSuffix
Extract the units suffix of 'value'. Only returns a non-zero length string of there is also a numeric prefix.
Syntax:
wwunits:UnitsSuffix($value)
Parameters:
Name
Type
Description
value
string
The value.
Returns:
string: A string.
Example:

<xsl:variable name="VarNumber" select="wwunits:UnitsSuffix('24px')" />

Was this helpful?
Last modified date: 01/12/2026