This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: xsl:key and document()


> -----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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]