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

[XSLT 2.0] Checking that an element's value has the d

Subject: [XSLT 2.0] Checking that an element's value has the desired datatype?
From: "Costello, Roger L." <costello@xxxxxxxxx>
Date: Mon, 16 Oct 2006 11:34:14 -0400
xslt check value is integer
Hi Folks,

Below is an XML document containing information about the Altitude of
an Aircraft.

I have written a stylesheet to check the Altitude's value, to see if it
is an integer.  Below is my stylesheet.

My stylesheet uses this statement:

   <xsl:value-of select="data(flt:Aircraft/flt:Altitude) instance of
xsd:integer"/>

The output I get is: "false"

(The output I seek is "true", as the Altitude element does have an
integer value.)

Can someone tell me the correct way to do this?

Thanks!  /Roger

-----------------------------------------------------------------------
----------
<?xml version="1.0"?>
<Flight xmlns="http://www.aviation.org">
    <Aircraft>
        <Altitude>3300</Altitude>
    </Aircraft>
</Flight>
-----------------------------------------------------------------------
----------
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                       xmlns:flt="http://www.aviation.org"
                       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                       version="2.0">

    <xsl:output method="html"/>

    <xsl:template match="flt:Flight">
      <html>
        <body>
            Check that the aircraft's altitude is an integer:
            <xsl:value-of select="data(flt:Aircraft/flt:Altitude)
instance of xsd:integer"/>
        </body>
      </html>
    </xsl:template>

</xsl:stylesheet>

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.