This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: node-set from a string?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]