This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
AW: AW: for-each with included variable
- To: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Subject: AW: AW: [xsl] for-each with included variable
- From: "Machelett, Renato (FA.G+M-EP/ETK)" <fa-gm-renato dot machelett at daimlerchrysler dot com>
- Date: Thu, 19 Apr 2001 17:24:00 +0200
- Reply-To: xsl-list at lists dot mulberrytech dot com
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@nag.co.uk [mailto:davidc@nag.co.uk]
> Gesendet am: Donnerstag, 19. April 2001 16:41
> An: xsl-list@lists.mulberrytech.com
> Betreff: Re: AW: [xsl] 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