RE: Which one to choose

Subject: RE: Which one to choose
From: Mike Brown <mbrown@xxxxxxxxxxxxx>
Date: Wed, 16 Feb 2000 11:37:13 -0700
Ural wrote:
>> Can anybody tell me how to access remote xml file.

Steve Muench wrote:
> http://remoteserver/file.xml ?

Ural, you got a terse answer because your question was vague. Can we assume
you meant to say that you want an XSL stylesheet to refer to data in a
remote XML file? If so, then you need a URI that points to the XML file. Use
it as the argument to the document() function:

<xsl:variable name="foo" select="document('http://remoteserver/file.xml')"/>

Then, if the resource identified by the URI could be parsed, $foo will be a
node-set containing the root node from file.xml. You can put it in an XPath
expression to get data from the document:

<xsl:value-of select="$foo/path/to/some/nodes"/>

If the resource identified by the URI could not be parsed, your XSL
processor is supposed to either signal an error or return an empty node-set.
XT does the former and aborts processing, so it's best to have some control
over the documents you are obtaining in this manner.

You can also use a node-set as the argument to document(). The string-values
of the nodes will be used as a list of URIs, and the function will return
the union of root nodes from those documents.

There are a few other features of the document() function explained in the
XSLT spec at http://www.w3.org/TR/xslt#document


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


Current Thread