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

Re: document() path relative to current document

Subject: Re: document() path relative to current document
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Tue, 23 Nov 2004 21:55:13 +0000
xsl document variable
Hi Robert,

> I believe that you and David are right, BUT how can I make the value of an
> attribute @href a node-set?
>
> I have <a href="folder/foo.html"> and want to read data from that external
> file. I save the url to a variable by using <xsl:variable name="bar"
> select="@href"/>. So $bar is still just a string.
> select="@href"/> When I provide this to the
> document function by document($bar,/) i suppose it will not magically become
> a nodeset.

You're missing the point. An XPath location path such as "foo/bar",
"//baz" or "@href" returns a node-set. In some circumstances, that
node-set might get converted to a string, for example when you
use it as one of the arguments to the concat() function, but if you
set a variable like:

  <xsl:variable name="bar" select="@href" />

then the value of the $bar variable is a node-set. The node-set
held by the $bar variable contains a single node: the href attribute
of the current node. The $bar variable does not contain a string. (I
say this repeatedly in as many ways as I can just to drum it in.)

When you provide it to the document function as in:

  document($bar)

the argument to the document() function is a node-set, not a string.
Therefore it should work in exactly the way that David and Mike have
told you it should work. If it doesn't work in that way, you need to
start looking for other reasons why not.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

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.