[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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

Subject: Re: When is a variable a nodeset and when isn't it?
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Mon, 9 Jun 2003 13:28:26 +0200
node set expected
String and node-set are different datatypes in XPath -- a string cannot be
used where a node-set is expected.

Therefore:

      /x/y/'someString'/z

is illegal.

So is:

    /x/y/$someVariable/z

Try using:

   /x/y/*[name() = $someVariableContainingAString]/z



=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL




<Simon.Fairey@xxxxxx> wrote in message
news:OFBAC09D9D.CCF6A5B2-ON80256D40.0032DD8E-80256D40.0033955D@xxxxxxxxx
> 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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.