Units

Purpose:
Utility methods for extracting units and value from raw strings along with unit-to-unit conversion routines.
Namespace:
urn:WebWorks-XSLT-Extension-Units
Prefix:
wwunits
Methods:
NumericPrefix(string value):

Extract the numeric prefix of the given string.

Returns:
String.
Example:

Determine numeric prefix of 24px.

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

Extract the units suffix of the given string. Only returns a non-zero length string of there is also a numeric prefix.

Returns:
String.
Example:

Determine units of 24px.

<xsl:variable name="VarNumber" select="wwunits:UnitsSuffix('24px')" />
Convert(double sourceValue, string sourceUnits, string targetUnits):

Convert a measurement from one set of units to another.

Returns:
Number.
Example:

Convert 2in to centimeters (cm).

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

xx

Returns:
xx
Example:
xx
RTFColor(string htmlColor):

Convert a standard HTML/CSS color to an RTF color.

Returns:
RTF color as string.
Example:

Convert #FF3399 to an RTF color.

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

Convert the given HTML/CSS color to a hex encoded CSS color. Useful for converting named colors such as green to their hex equivalents.

Returns:
Hex encoded CSS color as string.
Example:

Convert green to the hex equivalent.

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

Determine the HTML encoding for a page given a Windows code page value.

Returns:
String.
Example:

Determine the HTML encoding for code page 23.

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

DevCenter/Documentation/ExtensionObjects/ePublisher/Units (last edited 2010-08-23 19:04:45 by BenAllums)