[xsl] Re: Re: Passing Variables to XSL Templates

Subject: [xsl] Re: Re: Passing Variables to XSL Templates
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Wed, 27 Jun 2001 05:35:18 -0700 (PDT)
cutlass (Jim Fuller) wrote:

> use <xsl:param/> but it will depend on what is parsing the xml/xslt
> if u are using M$ then go to www.netcrucible.com and www.bayes.co.uk to get
> the dope on how to do it.

MSXML3 and 4 SDK documentation is not secret -- this is described there.

> other parsers usually will let you define params within the command line
> form,

msxsl.exe is the command-line utility for MSXML -- version 3 and above.

It supports passing parameters on the command line:

L:\>msxsl /?
Microsoft (R) XSLT Processor Version 4.0

Usage: MSXSL source stylesheet [options] [param=value...] [xmlns:prefix=uri...]

    -?            Show this message
    -o filename   Write output to named file
    -m startMode  Start the transform in this mode
    -xw           Strip non-significant whitespace from source and stylesheet
    -xe           Do not resolve external definitions during parse phase
    -v            Validate documents during parse phase
    -t            Show load and transformation timings
    -             Dash used as source argument loads XML from stdin
    -             Dash used as stylesheet argument loads XSL from stdin

Passing a node-set as parameter in MSXML is most easily accomplished using

Another way to do this is prior to performing the transformation to locate in the
loaded stylesheet the xsl:param or xsl:variable in question using selectSingleNode()
and then to modify (via setAttribute()) its "select" attribute to the value of an
XPath expression, which will evaluate to the necessary node-set.

> and maybe http://www.dpawson.co.uk/xsl/sect2/N5982.html this will help also,
> once you have got the param into your stylesheet.

The above is not described in http://www.dpawson.co.uk/xsl/sect2/N5982.html

Dimitre Novatchev.

Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail

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

Current Thread