[Home] [By Thread] [By Date] [Recent Entries]
Jeffry Proctor wrote:
2. Is there a way to have another xml file as a lookup list for attributes like gender typeCode tc or state typeCode tc so that the one XSL is easier to manage? Yes, you can load other documents with the XSLT 'document' function and then access nodes e.g. <xsl:template match="foo"> <xsl:value-of select="document('lookup.xml')/root/bar[. = current()]/code"/> <xsl:template> Using a key might make such a lookup more efficient (but is a bit akward to code with XSLT 1.0: <xsl:key name="k1" match="bar" use="."/> <xsl:template match="foo">
<xsl:variable name="this" select="."/>
<xsl:for-each select="document('lookup.xml')">
<xsl:value-of select="key('k1', $this)/code"/>
</xsl:for-each>
</xsl:template>-- Martin Honnen http://msmvps.com/blogs/martin_honnen/
|

Cart



