This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: xsl:key and document()
- To: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] xsl:key and document()
- From: Robert Goheen <RobertG at avenuea dot com>
- Date: Mon, 8 Jan 2001 17:46:54 -0800
- Reply-To: xsl-list at lists dot mulberrytech dot com
> -----Original Message-----
> From: David Carlisle [mailto:davidc@nag.co.uk]
>
> Why wouldn't you want to use a variable?
>
Actually, its because I keep getting mixed up and asking dumb questions....
For a moment, I forgot that variables were set only within the context, so
you could set them again once you left that scope. Because being unable to
never change a variable was so alien to me, and because I had to radically
change my thinking, I've wound up swinging too far to the left and developed
a fear of setting a variable twice in an XSLT.
To put it more concisely, I forgot that this was acceptable:
<xsl:for-each select="Tag">
<xsl:variable name="TagID" select="@ID" />
<xsl:for-each select="document('LUType.xml')">
<xsl:value-of select="key('LUType', $TagID)" />
</xsl:for-each>
</xsl:for-each>
Because I knew the xsl:variable would be called multiple times. At least,
I'm making fewer silly mistakes per day.....
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list