This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: node-set from a string?
- From: "Michael Kay" <michael dot h dot kay at ntlworld dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Wed, 3 Jul 2002 15:38:24 +0100
- Subject: RE: [xsl] node-set from a string?
- Reply-to: xsl-list at lists dot mulberrytech dot com
> I need to find a way to pass a well-formed XML string into an
> XSLT transformation
You can't do anything with a well-formed XML string until you have
parsed it; and there is no standard way of parsing XML from within a
transformation, so it's better to parse it first and then pass in the
resulting tree.
(Though Saxon 7.1 offers saxon:parse() as an extension function.)
The xx:node-set() function does something quite different.
Michael Kay
Software AG
home: Michael.H.Kay@ntlworld.com
work: Michael.Kay@softwareag.com
so that I can
> a) Extract a bit of data from it to use during the transform
> b) Pass the string intact so that it becomes the value of an
> HTML input in a web page which can subsequently submitted to
> another page so as to preserve state information.
>
> I am working with the Oracle XML Developer's Kit which I have used
> sucessfully for some months now. Now I'm coming to a feature which
> I haven't used before, but I've seen it discussed on the list from
> time to time.
>
> I think I need to use the "oracle:node-set()" function to draw this
> string into an object (a node-set object) on which I can use XPath
> to extract the the bit of data I need during the transformation.
>
> Looking on page 758 of XSLT Programmer's Reference (2nd Edition), I
> see what looks like the nugget I'm looking for. Except for
> one thing. What I want to turn into a node-set comes into my
> XSLT as a parameter.
>
> This parameter is a string (I've doubly-quoted it so that the
> processor
>
> does not try to interpret it as an XPath statement. The example in the
>
> book uses unquoted, literal XHTML in defining the content of
> the variable.
>
> Here is the place where I try to make the magic happen:
>
> ...
> <xsl:param name="passThroughs" />
> <xsl:template match="/">
> <xsl:variable name="passThroughDoc"
> select="oracle:node-set($passThroughs)"
> xmlns:oracle="http://www.oracle.com/XSL/Transform/java"
> /> ... And here is the error message I get when I fail:
> ORA-20100: Error occurred while processing: XSL-1019:
> (Error) Expected 'result-tree-fragment' instead of 'string'.
>
> Am I completely on the wrong path here, or is there some small thing
>
> which has escaped my notice?
>
> Thanks.
>
> --
> Charles Knell
> cknell@onebox.com - email
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list