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

RE: dynamic variable name/implementation question

Subject: RE: dynamic variable name/implementation question
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 26 Aug 2005 15:31:58 +0100
java dynamic variable name
The exsl:node-set() function converts a result tree fragment to a node-set,
it doesn't parse source XML to create a document node.

The simplest (most standard) approach if you're invoking the transformation
from the command line is probably to put the XML in a file, pass the URI of
that file as a stylesheet parameter, and then load the document from within
the stylesheet using the document() function.

In Saxon you could pass the parameter as +parameters=doc.xml, the "+" sign
would cause the contents of the file doc.xml to be parsed, and the resulting
document node would be the value of the parameter. AFAIK Xalan has no
equivalent mechanism.

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

> -----Original Message-----
> From: Ed S [mailto:lists@xxxxxxxxxxxxxxxxxxxxx] 
> Sent: 26 August 2005 15:11
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE:  dynamic variable name/implementation question
> 
> 
> 
>  
> > The usual solution is that instead of passing your stylesheet three
> > parameters x, y, and z, you should pass it an XML document 
> > 
> > <param>
> >   <x>1</x>
> >   <y>2</y>
> >   <z>3</z>
> > </param>
> > 
> > and then you can navigate this document at will using XPath.
> 
> I'm having a bit of trouble doing this.
> I'm running xalan as follows:
> >java org.apache.xalan.xslt.Process -IN ext.xml -OUT 
> ext_out.xml -XSL ext.xsl -PARAM parameters 
> "<param-list><a>hello</a><b>goodbye</b></param-list>"
> 
> however, when I execute:
> <xsl:value-of select="exsl:node-set($parameters)"/>
> I would expect to get the values of all of the text nodes within, ie:
> hellogoodbye
> 
> however, $parameters is resolved as a string:
> &lt;param-list&gt;&lt;a&gt;hello&lt;/a&gt;&lt;b&gt;goodbye&lt;
> /b&gt;&lt;/param-list&gt;
> 
> Maybe I don't understand the purpose of node-set()...

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.