RE: [xsl] Is there a way to tell if a node is an integer?

Subject: RE: [xsl] Is there a way to tell if a node is an integer?
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sat, 22 Apr 2006 09:17:13 +0100
> Is there a way to tell if a node is an integer? I found this message:
> http://www.xslt.com/html/xsl-list/2004-10/msg00364.html where 
> it appears to say you can use a statement like this:
> 
> <xsl:if test="data($a) instance of xs:integer">
> 
> But this looks kind of strange, and maybe it is pseudo-code 
> because it breaks my transform. 

This code should work provided that:

(a) you are running an XSLT 2.0 schema-aware processor

(b) your source document has been validated against a schema that declares
the type of the element to be an integer.

(c) you have bound "xs" to the XML Schema namespace.

To know which of those conditions you haven't met, I would want to see the
error message...

Michael Kay
http://www.saxonica.com/

Current Thread