[Home] [By Thread] [By Date] [Recent Entries]
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
|

Cart



