[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: 'true' or true()
On 01/11/2010 21:14, Karl Stubsjoen wrote:
In XSLT 2.0, declare the expected type of the parameter: <xsl:param name="isTrue" select="true()" as="xs:boolean"/>.I have a parameter which will either be, true() by default or 'true' (set by user). Given the name isTrue, how do you properly write the if test below: The way parameters are passed to a stylesheet depends on the product and API you are using: for example from the Saxon command line you will be able to pass the string values "true", "false", "0", or "1", but the important thing is that whatever is passed, you know you are dealing with a boolean, and not (say) a string. If you can't do this, then validate the parameter within your code: <xsl:when test="$isTrue='true'">... <xsl:when test="$isTrue='false'">... <xsl:otherwise><xsl:message... Don't just take the effective boolean value. The EBV of all strings other than "" is true. Michael Kay Saxonica
|
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
|