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

RE: Passing a variable number of parameters to a named

Subject: RE: Passing a variable number of parameters to a named-temp late
From: Chris Gow <cgow@xxxxxxxxxxxxxxxxxx>
Date: Thu, 18 Jan 2001 21:24:06 -0500
christopher gow
Cool. Thnaks, I'll try it out.

Chris


At 05:58 PM 1/18/01 -0800, you wrote:
If you're using XSLT 1.1 processor (SAXON is the only one I know that won't
barf), you can do something like:

<xsl:call-template name="process_nodeset">
        <xsl:with-param name="rtf"><a>1</a><b>2</b></xsl:with-param>
<xsl:call-template>

<xsl:template name="process_nodeset">
        <xsl:value-of select="$rtf"/>
</xsl:template>

I think you could get at the values by using
        <xsl:value-of select="$rtf/a"/>
        <xsl:value-of select="$rtf/b"/>
but I haven't tried that.

If you're using XSLT 1.0, it's the same idea, but you can't say
select="$rtf" because 1.0 doesn't implicitly convert Result Tree Fragments
into nodesets, so you have to call an extension function that does the
conversion (most processors have one, it might be called different names,
but nodeset() or node-set() are common):

<xsl:value-of select="myprocessor:node-set($rtf)"/>

If you want to keep this parser-independent and don't want to use the
extension function, you'll have to be a little tricky and access your
stylesheet as an external XML document using document() function. There's
some information on how to use document() in various places, check the list
archive, the FAQ, the spec, or www.jenitennison.com

- Eugene

: -----Original Message-----
: From: Chris Gow [mailto:cgow@xxxxxxxxxxxxxxxxxx]
: Sent: Thursday, January 18, 2001 5:15 PM
: To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
: Subject: RE:  Passing a variable number of parameters to a
: named-temp late
:
:
: OK.  Can I create the nodeset within my actual XSL
: Stylesheet?  The data
: that I want to operate on will be created within the
: stylesheet itself and
: not be coming from an XML file.
:
: Chris
:
: At 05:00 PM 1/18/01 -0800, you wrote:
: >: What I would like to do is duplicate what programming
: >: languages have:  pass
: >: a number of parameters (or some similar mechanism) to a
: >: template without
: >: knowing how many parameters were actually passed.  For
: >: example, JavaScript
: >: has the arguments array and Java allows you to pass an array of
: >: objects.  Can I implement something similar in XSL?  I did a
: >
: >You can pass a nodeset, which can be treated as the XML
: equivalent of an
: >array.
: >
: >- Eugene
: >
: >  XSL-List info and archive:
: http://www.mulberrytech.com/xsl/xsl-list
:
:
:  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
:

XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


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.