[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Passing xs:string containing zero characters

Subject: Re: Passing xs:string containing zero characters
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 19 May 2010 09:22:19 +0100
Re:  Passing xs:string containing zero characters
On 19/05/2010 02:01, Toshihiko Makita wrote:
Hi!

I'm new to XSLT 2.0 and using it with Saxon 9.1 in DITA-Open Toolkit.
I wrote following variable and pass it as a parameter as $prmLang to the
template.

<xsl:variable name="lang" as="xs:string" select="string(@xml:lang)"/>

<xsl:apply-templates select="child::*[contains(@class, '
topic/related-links ')]">
<xsl:with-param name="prmLang" as ="xs:string" select="$lang"/>
</xsl:aplly-templates>

<xsl:template match="*[contains(@class, ' topic/related-links ')]">
<xsl:param name="prmLang" as="xs:string" required="yes"/>
...
</xsl:template>

Then the following error is occured when $lang is empty string.

"[xslt] D:\DITA-OT1.5-FB\demo\xxx\xsl\xxx_dita2fo_relatedlinks.xsl:34:
Fatal Error! No value supplied for required parameter"

Is it a right behavior? I thought that xs:string can contain any
sequence of zero or more characters.

(If I rewrite the template code required="yes" to select="''", then it
works fine.)


the error message is not sayinbg that an empty string was passed in, it is sayinbg that no value at all is supplied. that is not normally an error but you have made it so by saying required="yes". the _only_ thing that does is generate an error if the parameter is not passed.


Presumably at some point you apply templates without having a suitable xsl:with-param.

David


________________________________________________________________________ The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. ________________________________________________________________________


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.