Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #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
Reply With Quote
  #2 (permalink)  
Old July 27th, 2006, 03:09 PM
mhkay's Avatar
Wrox Author
Points: 18,481, Level: 59
Points: 18,481, Level: 59 Points: 18,481, Level: 59 Points: 18,481, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,960
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
Reply With Quote
  #3 (permalink)  
Old July 27th, 2006, 03:11 PM
mhkay's Avatar
Wrox Author
Points: 18,481, Level: 59
Points: 18,481, Level: 59 Points: 18,481, Level: 59 Points: 18,481, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,960
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 09:45 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.