1. Stylesheet parameters
2. Top level parameter defaults
3. passing parameters with spaces to a stylesheet


Stylesheet parameters

Scott Boag

<?xml version="1.0"?>
  xmlns:xsl="" version

  name="testing">#Default Error String</xsl:param>

  <xsl:template match="/">
      <xsl:with-param name="foo" select="$testing"/>

  <xsl:template match="someelement">
    <xsl:param name="foo"/>
    <xsl:value-of select="$foo"/>


You can access $testing from foo directly also.  This was
tested on the command line with -param testing "'testing
val'".  The output on my build was:

<?xml version="1.0" encoding="UTF-8"?>
<out>testing val</out>



Top level parameter defaults

Wendell Piez

Setting the parameter default as

<xsl:param name="x" select="false()"/>

The value of $x is a Boolean false (XPath 4.3). Then the test

<xsl:if test="$x"> ... </xsl:if>

will fail unless the default is overridden by a parameter
passed in.


passing parameters with spaces to a stylesheet

Mike Kay

> Can anyone tell me how to pass parameters with spaces in the value
> to a stylesheet via the command line. 

I don't know of any way of doing it. Certainly there's
nothing in Saxon to enable it. The Java documentation is
remarkably vague about the syntax of the command line, and I
don't know whether it depends on which shell you're
using. When will the industry come up with a decent job
control language?

If no-one comes up with anything, you'll have to pass the
thing in with an underscore or such like, and use
translate() within the stylesheet to change it.