Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
| Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old July 27th, 2006, 06:14 AM
Authorized User
 
Join Date: May 2006
Location: Haarlem, , Netherlands.
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default testing integer

I'm creating a xslt template that creates schematron rules for testing xsd elementtypes
when I get to the point that I want to test for simple type elements and test the restriction types I use this XSL syntax:
<xsl:if test="xsd:restriction/@base">
   <xsl:element name="sch:assert">
     <xsl:attribute name="test">(normalize-space(.)) instance of <xsl:value-of select="xsd:restriction/@base"/></xsl:attribute>
      This is no <xsl:value-of select="xsd:restriction/@base"/> type
   </xsl:element>
</xsl:if>

for xsd:int this generates the expression:
 <xsl:when test="(normalize-space(.)) instance of xsd:int"/>

But when I get to an element with the restriction base is xsd:int the test for "instance of xsd:int" is not recognized but the test "instance of xsd:integer" is recognised. In OXYGEN I get the message:
the type xsd:int is not recognized by a basic XSLT processor. Also long and short is not recognized. Does that mean that in XSLT you can only test for types higher in the type hierarchy with the expression 'instance of'?

I use SAXON 8B for testing
  #2 (permalink)  
Old July 27th, 2006, 03:09 PM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

There are two conformance levels for XSLT 2.0, basic and schema-aware. Saxon-B implements the basic level. This allows only primitive data types plus xs:integer, it doesn't allow derived types such as xs:int.

There is however a switch in Saxon-B to recognize these types. Set

saxon:allow-all-built-in-types="yes"
xmlns:saxon="http://saxon.sf.net/"

on the xsl:stylesheet element

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
  #3 (permalink)  
Old July 27th, 2006, 03:11 PM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

See also

http://www.archivesat.com/SAXON_XSLT...read625922.htm

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference


Similar Threads
Thread Thread Starter Forum Replies Last Post
Integer I/O in assembly kaycg BOOK: Professional Assembly Language 2 May 11th, 2007 05:00 AM
text vs integer paul20091968 Access VBA 2 February 13th, 2007 10:50 PM
How knowing it is an integer? rtr1900 Classic ASP Basics 1 October 5th, 2006 07:40 AM
integer overflow partaola Beginning VB 6 2 March 17th, 2004 09:01 AM
Testing for integer MattLeek Excel VBA 8 March 7th, 2004 09:15 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.