Try this XSLT ...
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" indent="yes"/> <xsl:variable name="symbols" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" /> <xsl:variable name="symbols-count" select="string-length($symbols)" /> <xsl:template match="row"> <row> <xsl:call-template name="convert" /> </row> </xsl:template> <xsl:template name="convert"> <xsl:param name="value" select="number(.)" /> <xsl:choose> <xsl:when test="$value >= $symbols-count"> <xsl:variable name="div" select="floor($value div $symbols-count)" /> <xsl:variable name="remainder" select="$value - $div * $symbols-count" /> <xsl:call-template name="convert"> <xsl:with-param name="value" select="$div" /> </xsl:call-template> <xsl:value-of select="substring($symbols, $remainder + 1, 1)" /> </xsl:when> <xsl:otherwise> <xsl:value-of select="substring($symbols, $value + 1, 1)" /> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet>
For the following XML
<root> <row>12</row> <column>23</column> <row>26</row> <column>23</column> </root>
The following is displayed:
<root> <row>M</row> <column>23</column> <row>BA</row> <column>23</column> </root>
You should be able to configure a character variable to allow any conversion with name-naming-imal. For example, to convert to hexadecimal change, follow these steps:
<xsl:variable name="symbols" select="'0123456789ABCDEF'" />
And for binary
<xsl:variable name="symbols" select="'01'" />
Tim c source share