Re: [xsl] When is a variable a nodeset and when isn't it?

Subject: Re: [xsl] When is a variable a nodeset and when isn't it?
From: Simon.Fairey@xxxxxx
Date: Mon, 9 Jun 2003 10:28:33 +0100
Obviously the typo regarding existence of a church node implying there is 
an airport can be ignored!!

*sigh* too early for fighting with XSL :-)

Si




Simon.Fairey@xxxxxx
Sent by: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
09/06/2003 10:23
Please respond to xsl-list

 
        To:     xsl-list@xxxxxxxxxxxxxxxxxxxxxx
        cc: 
        Subject:        [xsl] When is a variable a nodeset and when isn't it?


Hi,

Had a look through the past posts and a few mentioned similar things but 
I'm still a tad confused.

Given:
<xsl:template match="/all">
        <xsl:variable name="root" select="/all/data/town"/>
        <xsl:for-each 
select="$root/climate|$root/transportation|$root/tourism">
                <xsl:variable name="section" select="name()"/>
                <xsl:if test="$root/$section/church">
                        Airports exist<br/>
                </xsl:if>

etc....

Now in the for-each it seems to evaluate $root as part of the x-path 
expression and works however it doesn't seem to like it in the test. If I 
print $root it gives me the contents of the nodeset rather than just the 
string. Should I be creating the root variable in a different way so that 
it is treated as a simple string?

Not sure I'm being very clear here (waiting on an proper XSL course atm!) 
essentially XMLSpy barfs on the xsl:if. I'm thinking there is something 
fundamental about how XSL works that I'm missing here as well!

Thanks

Si


**********************************************************************************
This email may contain confidential material. If you were not an
intended recipient, please notify the sender and delete all copies.
We may monitor email to and from our network.


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list








 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread