Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] Empty String param

From: Tony Graham <Tony.Graham@---------------------->
To:
Date: 4/2/2008 4:04:00 PM
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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent