[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Passing variables into XSLT via parameters ... can't get it to work


Subject: Re: [xsl] Passing variables into XSLT via parameters ... can't get it to work
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 24 May 2006 09:52:08 +0100

> $parameters is defined as a string passed in from the processor, and my 
> understanding was that I needed to coerce to a node set explicitly; 

you can't siumply coerce from a string to a node set you need to parse
the string with an XML parser. xx:node-set() does not take a string as
an input it takes a result tree fragment (which is more or less the same
thing as a node set in any case, and in XSLT2 _is_ the same thing, so
xx:node-set() is no longer needed in XSLT2)


> This may not be the ideal way to do it; What I was hoping to achieve was 
> a way to pass in arbitrary variables without having to hardcode variable 
> names into the stylesheet and preferably avoiding having to make 2 

That's fine but you need to pass in a node set (ie a parsed document0
not a string.

> I haven't seen any way to pass a parsed document node into libxslt, 
You can always just pass in the file name as a string parameter and then
use select="document($filename)/whatever"

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________


Current Thread
Keywords
xml