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

Checking for instance of xs:integer

Subject: Checking for instance of xs:integer
From: Kenneth Stephen <marvin.the.cynical.robot@xxxxxxxxx>
Date: Mon, 11 Oct 2004 13:01:18 -0500
xsl when instance of
Hi,

    I have the following code :

<?xml version="1.0"?>
<xsl:stylesheet version="2.0"
        xmlns:xs="http://www.w3.org/2001/XMLSchema"
        xmlns:xdt="http://www.w3.org/2003/11/xpath-datatypes"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

        <xsl:output omit-xml-declaration="yes" />

        <xsl:template match="/">
                <xsl:variable name="var">
                        <xsl:element name="a">
                                <xsl:value-of select="xs:integer(2)
treat as xs:integer" />
                        </xsl:element>
                </xsl:variable>

                <xsl:choose>
                        <xsl:when test="$var/a instance of xs:integer">
                                yes
                        </xsl:when>
                        <xsl:otherwise>
                                no
                        </xsl:otherwise>
                </xsl:choose>
        </xsl:template>

</xsl:stylesheet>

...where I'm trying to detect if a variable has an integer value. The
output that I currently get is :

bash-2.05b$ java net.sf.saxon.Transform intck.xsl intck.xsl 

                                no

    At first I thought that this is because the xsl:value-of that is
used to assign the value of $var/a was producing either a string or an
untypedAtomic value. However, changing the "xsl:when" to test for
xs:string and xsd:untypedAtomic didnt work either. Is there any way to
get this to work without using a schema aware processor?

Thanks,
Kenneth

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.