Re: [xsl] [XSL 3.0] Function that check if a xs:string can be converted as a xs:double

Subject: Re: [xsl] [XSL 3.0] Function that check if a xs:string can be converted as a xs:double
From: "David Carlisle d.p.carlisle@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 31 May 2023 13:11:48 -0000
On Wed, 31 May 2023 at 13:13, Christophe Marchand cmarchand@xxxxxxxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> Ah ! Yes ! castable as...
>
> I've also found xs:boolean(number(s)) is working correctly.
>

hmmm
<xsl:stylesheet version="3.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:xs="http://www.w3.org/2001/XMLSchema"; >
 <xsl:param name="s"/>
 <xsl:template name="m">
A  <xsl:sequence select="xs:boolean(number($s))"/>
B  <xsl:sequence select="$s castable as xs:double"/>
 </xsl:template>
</xsl:stylesheet>


$ saxon10 -it:m bool.xsl s=1
<?xml version="1.0" encoding="UTF-8"?>
A  true
B  true


but...

$ saxon10 -it:m bool.xsl s=0
<?xml version="1.0" encoding="UTF-8"?>
A  false
B  true



> Thanks Martin !
> Christophe
> EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/2739265> (by
> email <>)

Current Thread