xsl-list
[Top] [All Lists]

RE: [xsl] Empty String param

2008-04-02 07:36:12
From: Kerry, Richard [mailto:richard(_dot_)kerry(_at_)siemens(_dot_)com] 
Sent: 02 April, 2008 10:21
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Empty String param

 
I want to declare an xsl parameter which is a string, and may 
be empty when called.
The system doesn't seem to allow me to do this.
I'm using Saxon-9.
 
I say
 
<xsl:template name="insert">
<xsl:param name="default" />
<!-- various stuff using $default-->
</xsl:template>
 
And eventually I do
<xsl:call-template name="insert">
<xsl:with-param name="default" 
select="$named-nodes[1]/@default" /> </xsl:call-template>
 
So that I can get the value of default from an atribute in 
another document ($named-nodes).
This attribute may be, and often is, absent.  In which case 
I'd expect default to be an empty string. Which it is for this test.
 

You need to change your parameter definition to:

<xsl:param name="default" as="xsd:string?"/>

which says that $default can be a string or absent.


Andy.


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>