RE: [xsl] getting type information in xslt 2.0

Subject: RE: [xsl] getting type information in xslt 2.0
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 23 Oct 2006 08:56:56 +0100
You can test whether a node is an instance of a particular type by using
"instance of". There's no way in standard XPath 2.0 of asking for the type
that a particular node (or atomic value) belongs to. Saxon does have an
extension function for this purpose, saxon:type-annotation(). It's useful
for debugging purposes, but if you actually want to act on the information,
"instance of" is safer because the actual type annotation can always be a
subtype of what you are expecting.

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

> -----Original Message-----
> From: Erik Wilde [mailto:net.dret@xxxxxxxx] 
> Sent: 23 October 2006 05:23
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Cc: Felix Michel
> Subject: [xsl] getting type information in xslt 2.0
> 
> hello everybody.
> 
> i am happy to see the support of xml schema and xml schema 
> type annotations in xpath 2.0. however, i am wondering how i 
> can actually get that type information. xdm defines an 
> accessor function for the type
> information:
> 
> http://www.w3.org/TR/xpath-datamodel/#dm-type-name
> 
> but there does not seem to be an xpath function which lets me 
> use this xdm accessor function. so the questions i am having is:
> 
> - is it correct that this xdm accessor function is not 
> available in xpath?
> 
> - if so, how can i get the type information about an element 
> in xpath? 
> the functions on nodes in xpath seem to give no way to get to 
> these precious annotations in the xdm tree.
> 
> http://www.w3.org/TR/xpath-functions/#node-functions
> 
> funny enough, xslt 2.0 then gives me a special function to 
> discard the type annotations, but i am wondering why it is 
> that i can throw them away, but not get to them?
> 
> http://www.w3.org/TR/2005/CR-xslt20-20051103/#stripping-annotations
> 
> maybe i am simply not looking at the right things, but i 
> really could not find a way to get the type information in 
> xpath/xslt 2.0, so any help would be greatly appreciated!
> 
> thanks and cheers,
> 
> dret.

Current Thread