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

Re: passing a sequence as a parameter

Subject: Re: passing a sequence as a parameter
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Tue, 26 Feb 2008 16:21:51 +0000
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/

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.