This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: hex\decimal
- To: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] hex\decimal
- From: "Mitchell, Edmund" <EMitchell at fnf dot com>
- Date: Tue, 1 May 2001 08:45:34 -0700
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hello
I think Goetz posted this a long time ago ( Sorry if the cite is off)
<xsl:template name="printHex">
<xsl:param name="number">0</xsl:param>
<xsl:variable name="low">
<xsl:value-of select="$number mod 16"/>
</xsl:variable>
<xsl:variable name="high">
<xsl:value-of select="floor($number div 16)"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$high > 0">
<xsl:call-template name="printHex">
<xsl:with-param name="number">
<xsl:value-of select="$high"/>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:text>0x</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="$low < 10">
<xsl:value-of select="$low"/>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="temp">
<xsl:value-of select="$low - 10"/>
</xsl:variable>
<xsl:value-of select="translate($temp, '012345', 'ABCDEF')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
I hope that helps
Edmund
Hello,
I have an XML file where the design work resulted in color values being
decimal values. I would like to convert these to Hex.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list