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

Re: node-set from a string?

Subject: Re: node-set from a string?
From: Mike Brown <mike@xxxxxxxx>
Date: Tue, 2 Jul 2002 17:49:32 -0600 (MDT)
xslt xmlstring node set
Charles Knell wrote:
> I need to find a way to pass a well-formed XML string into an 
> XSLT transformation

Long story short: you can't, at least not with pure, unextended XSLT.

Some XSLT processors do allow passing in a node-set as a parameter, but not
from the command line. You'll have to check the docs for your processor to see
whether it is even possible. Even if it is possible, you have to pass in
whatever the XSLT processor's implementation of a node-set is, which will
require constructing such an object yourself, by parsing the XML string. The
string itself is something you can derive a node-set from; it's not a
node-set, itself.

Better way: assign the XML string a URI (saving it to the local filesystem
would be one way), and use the document() function to access its root node. If
the string is in memory, use a custom URI resolver (again, check your
processor's docs) to access it. For example, you would make the custom
resolver return the XML string when it is asked for URI 'urn:my-xml-string';
then you need only pass in 'urn:my-xml-string' as parameter foo, and access it
via document($foo).

Other option: write an extension function or element that will take a string
argument, feed it to a parser, and return/produce a node-set. Again, check
your docs, as the implementation will vary from vendor to vendor.

> I think I need to use the "oracle:node-set()" function

The node-set() extension function won't help you convert a string to a
node-set.

   - Mike
____________________________________________________________________________
  mike j. brown                   |  xml/xslt: http://skew.org/xml/
  denver/boulder, colorado, usa   |  resume: http://skew.org/~mike/resume/

 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.