Subject: Re: [xsl] Empty String param From: Tony Graham <Tony.Graham@xxxxxxxxxxxxxxxxxxxxxx> Date: Wed, 02 Apr 2008 17:02:56 +0100 |
On Wed, Apr 02 2008 15:21:25 +0100, richard.kerry@xxxxxxxxxxx wrote: ... > <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. > > > I get an error as follows : > XTTE0570: An empty sequence is not allowed as the value of parameter > $default. > Referring to the xsl:with-param line. > > Why can't I pass in the empty string here ? > (ie why is it telling me that an empty sequence (should be a string) is > not allowed ?) I had trouble replicating your error message. Are you using tunnel parameters? I was able to induce error XTTE0590 (which is a more correct error code for this fault, irrespective of whether the fault is real or imagined) with Saxon 9.0.0.4 by using tunnel parameters. The following stylesheet runs without error, but will fail with XTTE0590 if you uncomment the xsl:call-template to the 'intermediate' template. ------------------------------------------------------------ <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:output method="xml"/> <xsl:variable name="named-nodes" as="element()*"> <node1 default1="a"/> </xsl:variable> <xsl:template name="insert"> <xsl:param name="default" /> <!-- various stuff using $default--> <xsl:value-of select="$default"/> </xsl:template> <xsl:template name="intermediate"> <xsl:param name="default" tunnel="yes" as="attribute()"/> <xsl:call-template name="insert"> <xsl:with-param name="default" select="$named-nodes[1]/@default" /> </xsl:call-template> </xsl:template> <xsl:template match="/"> <xsl:call-template name="insert"/> <!--<xsl:call-template name="intermediate"> <xsl:with-param name="default" select="$named-nodes[1]/@default" tunnel="yes" /> </xsl:call-template>--> </xsl:template> </xsl:stylesheet> ------------------------------------------------------------ Regards, Tony Graham Tony.Graham@xxxxxxxxxxxxxxxxxxxxxx Director W3C XSL FO SG Invited Expert Menteith Consulting Ltd XML, XSL and XSLT consulting, programming and training Registered Office: 13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland Registered in Ireland - No. 428599 http://www.menteithconsulting.com -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- xmlroff XSL Formatter http://xmlroff.org xslide Emacs mode http://www.menteith.com/wiki/xslide Unicode: A Primer urn:isbn:0-7645-4625-2 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "Testing XSLT" tutorial, XTech 2008, Dublin, Ireland, May 6 2008
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Empty String param, G. Ken Holman | Thread | [xsl] RNV and xsi:types, Joe McDuffey |
Re: [xsl] Empty String param, G. Ken Holman | Date | [xsl] Splitting files 5 at a time, Danny Leblanc |
Month |