Re: [xsl] Need help for XSL beautifaction

Subject: Re: [xsl] Need help for XSL beautifaction
From: "Jon Gorman" <jonathan.gorman@xxxxxxxxx>
Date: Wed, 17 May 2006 12:55:36 -0500
Hoped there was a way like this:
<xsl:copy-of select="${<xsl:copy-of select='textNo'/>}"/>

Are you asking if there's anything like keys? Yes, keys.

Check out the faq and the w3 docs for more details, but essentially
you can do this one path by having a "reference map" of sorts.

the xslt 1.0 way

<textstring id="text-1">Don't you love maps</textstring>
<texstring id="text-2">yes, yes I do</textstring>

in the xslt: <xsl:variable name="textstrings" select="document(map.xml)/textstrings" /> <xsl:key name="texts" match="$textstrings/textstring" use="@id"/>

then in the appropriate template

<xsl:value-of select="key('texts',@idref)" />

where idref would be the text-1, however it is set in the input tree.

There's a shorter way to do this in xslt 2.0, don't remember off the
top of my head.

Typed this in a hurry. Look in the faq for better info.

Jon Gorman

Current Thread