Re: passing a sequence as a parameter
On 26/02/2008, Mukul Gandhi <gandhi.mukul@xxxxxxxxx> wrote: > On Tue, Feb 26, 2008 at 8:47 PM, David Carlisle <davidc@xxxxxxxxx> wrote: > > It's actually very common that you want to pass (for example) a document > > node rather than a string, and I think it's reasonable to declare this > > using as= on the xsl:param declaration. > > > Could you please demonstrate this with an example (i.e. passing a > document node as a parameter to the stylesheet). Say you pass: <foo>1</foo> as a parameter to the stylesheet with a param definition of: <xsl:param name="foo" as="document-node()"/> If it's passed a string: "<foo>1</foo>" you'll get an error, but if its passed as a document node then it will be fine. The problem is constructing the document in the host language and then passing it in - I've always found it to be a pain and it does limit how your transform can be run (not from the command line for example) so instead I would always pass in strings and manage the process myself: <xsl:param name="foo-str" as="xs:string"/> <xsl:variable name="foo" select="saxon:parse($foo-str)" as="document-node()"/> -- Andrew Welch http://andrewjwelch.com Kernow: http://kernowforsaxon.sf.net/
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format