Re: [xsl] passing a sequence as a parameter

Subject: Re: [xsl] passing a sequence as a parameter
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 26 Feb 2008 16:24:43 GMT
>  Could you please demonstrate this with an example (i.e. passing a
> document node as a parameter to the stylesheet).

actually on the command line you pass a ducument file or URI but it gets
passed in as a document node after being parsed.

No source file name
Saxon from Saxonica
Usage: see
  -a                    Use xml-stylesheet PI, not style-doc argument
  -c:filename           Use compiled stylesheet from file
  -cr:classname         Use collection URI resolver class
  -dtd:on|off           Validate using DTD
  -expand:on|off        Expand defaults defined in schema/DTD
  -explain[:filename]   Display compiled expression tree
  -ext:on|off           Allow|Disallow external Java functions
  -im:modename          Initial mode
  -it:template          Initial template
  -l:on|off             Line numbering for source document
  -m:classname          Use message receiver class
  -o:filename           Output file or directory
  -or:classname         Use OutputURIResolver class
  -outval:recover|fatal Handling of validation errors on result document
  -p:on|off             Recognize URI query parameters
  -r:classname          Use URIResolver class
  -repeat:N             Repeat N times for performance measurement
  -s:filename           Initial source document
  -sa                   Schema-aware transformation
  -strip:all|none|ignorable      Strip whitespace text nodes
  -t                    Display version and timing information
  -T[:classname]        Use TraceListener class
  -TJ                   Trace calls to external Java functions
  -tree:tiny|linked     Select tree model
  -u                    Names are URLs not filenames
  -val:strict|lax       Validate using schema
  -versionmsg:on|off    Warn when using XSLT 1.0 stylesheet
  -warnings:silent|recover|fatal  Handling of recoverable errors
  -x:classname          Use specified SAX parser for source file
  -xi:on|off            Expand XInclude on all documents
  -xmlversion:1.0|1.1   Version of XML to be handled
  -xsl:filename         Stylesheet file
  -y:classname          Use specified SAX parser for stylesheet
  -?                    Display this message 
  param=value           Set stylesheet string parameter
  +param=filename       Set stylesheet document parameter
  !option=value         Set serialization option

see the last but one line...

so you go 

saxon9  it=main style.xsl +doc1=file1.xml +doc2=file2.xml

where style.xsl has


<xsl:param name="doc1"/>
<xsl:param name="doc2"/>

<xsl:template name="main">
  <xsl:value-of select="$doc1/a/b/c"/>
  <xsl:value-of select="$doc2/a/b/c"/>

(saxon 8 and I think 7 had same feature but not saxon6 as far as I recall)


The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 

Current Thread