RogerTBrick wrote:
> THe XML file I am being give contains some code value that need to be
> exchanged for text in the final output (to HTML as it happens).
> <root>
> <thingy code="2"/>
> <root>
>
> My first solution (the one I thought would be easiest) was you use two
> comma spearated lists and simply grab the correct text value based on
> the index.
> <xsl:variable name="codes">1,2,3,4</xsl:variable>
> <xsl:variable name="text">aaa,bbb,ccc,ddd</xsl:variable>
>
> But I am stumped. Is this even possible with XSL? Or is there a
> better way of doing the substitution that I'm missing?
You can build a map in the XSLT stylesheet using elements in a separate
namespace and access it as follows
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns

sl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:mp="http://example.com/2005/03/map1">
<xsl

aram name="searchKey" select="1" />
<map xmlns="http://example.com/2005/03/map1">
<item>
<key>1</key>
<value>aaa</value>
</item>
<item>
<key>2</key>
<value>bbb</value>
</item>
</map>
<xsl:template match="/">
<result>
<xsl:value-of
select="document('')/xsl:stylesheet/mp:map/mp:item[mp:key =
$searchKey]/mp:value" />
</result>
</xsl:template>
</xsl:stylesheet>
--
Martin Honnen
http://JavaScript.FAQTs.com/