xsl-list
[Top] [All Lists]

Re: Converting <xml> StyleSheet param contents into a node set?

2005-08-17 01:40:37
Assuming that the xml is valid I guess my only question now is why #1
works and #2 doesn't?

#1 (untested)...works ...with <.>
<xsl:variable name="rtf">
<Node><Value>HI</Value></Node>
</xsl:variable>
<xsl:copy-of select="xalan:nodeset($rtf)/child::*/Value" />

#2 (untested)...doesn't works...with &lt; ...&gt;

<xsl:variable name="rtf">
&lt;Node&gt;&lt;Value&gt;HI&lt;/Value&gt;&lt;/Node&gt;
</xsl:variable>
<xsl:variable name="rtf2" select="xalan:nodeset($rtf)"
disable-output-escaping="yes"/>

<xsl:copy-of select="($rtf2)/child::*/Value"/>

I sincerely appreciate the discussion and help with this, Michael.

On 8/17/05, Michael Kay <mike(_at_)saxonica(_dot_)com> wrote:
If the parameter arrives as unparsed XML, then at some stage it's going to
have to be parsed into a tree. You can do that in the application before
invoking the stylesheet, or you can do it by a call-out from the stylesheet
to some kind of extension (in Saxon you could use saxon:parse()). I can't
tell from your description which is likely to be more convenient in your
case. One approach would be to do it in a URIResolver triggered by the
document() function, but I don't know if that's appropriate in Xalan-C.

Michael Kay
http://www.saxonica.com/

-----Original Message-----
From: Jacquo Johnson [mailto:genxgeek(_at_)gmail(_dot_)com]
Sent: 17 August 2005 08:06
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Converting <xml> StyleSheet param contents
into a node set?

Thanks for the reply, Michael!  The XSLT version is 1.0 and I'm using
Xalan v1.5 or v1.6 of the C/C++ for this specific application
solution.  I'm testing the raw transform itself  via JEdit using the
lastest build of the XSLT plugin for Xalan Java (not sure what version
that is).

However, I would like to avoid any disk i/o or uri specification for
this solution due to high message volume and fault tolerance.  Since I
recieve the xml filter specification within a Xerces Dom Document as
passed from a server I would like to  take the filter xml contents and
pass it into an existing stylesheet as xml contents
<Filter>....</Filter> itself.  This is all happening on the client
side in mememory and the only way that I can think of adhering to this
requirement is parsing the filtered xml node xml contents into an
existing stylesheet as a parameter.

Thoughts?

On 8/17/05, Michael Kay <mike(_at_)saxonica(_dot_)com> wrote:
The way you pass parameters to a stylesheet depends on the
API of the XSLT
processor that you are using. Many will allow you to pass a
DOM Document
node.

If you're using Saxon from the command line, the parameter
+Filter=filter.xml causes the file filter.xml to be parsed, and the
resulting document (root) node becomes the value of the parameter.

Another approach is to pass the URI as the stylesheet
parameter, and then
call document() from within the stylesheet.

Michael Kay
http://www.saxonica.com/

-----Original Message-----
From: Jacquo Johnson [mailto:genxgeek(_at_)gmail(_dot_)com]
Sent: 17 August 2005 02:07
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Converting <xml> StyleSheet param contents
into a node set?

HI all, can somebody tell me how I can pass <xml> contents into a
stylesheet param and then convert that <xml> contents
into a nodeset?


Stylesheet: ( Filter=<Node><Whatever/></Node> )
...
<xsl:param name="Filter" select="string('NULL')" />

   <xsl:copy-of select="$Filter"/>
...
Output:
   &lt;Node&gt;&lt;Whatever/&gt;&lt;/Node&gt;

However, I want to turn the xml contents above into a
node set that I
can later use in the transform.  Is that possible (is
there something
other than using CDATA)?

Any information would be greatly appreciated.


--~------------------------------------------------------------------
XSL-List info and archive:
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--






--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--