|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] AW: AW: for-each with included variable
Hi David,
Thank you for your comment, but I don't think I'm getting it. The situation
is the following:
I have that variable declared at global scope (at least I assumed I did when
including it), so the content cannot change - at least that's how I
understood the concept of XSL variables. As long as I'm not going out of
scope it will have the value it initially had.
<xsl:include href="IncludeMe.xsl"/>
<!-- $myOPTypeList declared here -->
<xsl:template select="/">
<xsl:for-each select="Whatever">
<xsl:for-each select="$myOPTypeList">
<!-- do some stuff -->
</xsl:for-each>
</xsl:for-each>
</xsl:template>
So I think what changes is the nodeset that is retrieved when applying the
content of the variable, not the content of the variable itself. Or is that
wrong?
What I cannot see - due to my poor knowledge of XPath - is the semantic
difference between:
<xsl:for-each select="(.//*[@OPTypeRef='Type1'])[1] |
(.//*[@OPTypeRef='Type2'])[1] | (.//*[@OPTypeRef='Type3'])[1]">
<!-- do some stuff -->
</xsl:for-each>
and
<xsl:variable name="myOPTypeList">XType1,XType2,XType3</xsl:variable>
<!-- global variable again -->
<xsl:for-each select="(.//*[@OPTypeRef[contains($myOPTypeList, .)]])[1]">
<!-- do some stuff -->
</xsl:for-each>
And there must be a difference because the output is not the same.
Renato
> -----Ursprüngliche Nachricht-----
> Von: davidc@xxxxxxxxx [mailto:davidc@xxxxxxxxx]
> Gesendet am: Donnerstag, 19. April 2001 16:41
> An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Betreff: Re: AW: for-each with included variable
>
>
> > The variable now holds
> > the entire expression, not just a list of single literals.
>
> It doesn't hold the expression: it holds the _value_ (ie node set)
> obtained by evaluating that expression at the point you have
> the xsl:variable. this might be a different value than would have been
> obtained by evalutaing the expression at the point you now use
> $myOPTypeList
>
> David
>
> _____________________________________________________________________
> This message has been checked for all known viruses by Star
> Internet delivered
> through the MessageLabs Virus Control Centre. For further
> information visit
> http://www.star.net.uk/stats.asp
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








