[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Empty String param
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|