Re: [xsl] [XSL] Declaring datatypes for Attributes

Subject: Re: [xsl] [XSL] Declaring datatypes for Attributes
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Thu, 10 May 2001 12:29:05 +0100
Hi Bernard,

> I knew that the type declaration was possible using schema but I
> thought that there was no tool which manage schema.

XSLT processors don't use schema information (not in XSLT 1.0, they
will in XSLT 2.0).  However, you can still tell it to sort numerically
rather than alphabetically.  It's not about the type of the node that
you're sorting by, actually, it's about the type of the sort value,
which might be something that's calculated.  For example, you could
sort by year with:

  <xsl:sort select="substring(@date, 7)" data-type="number" />

or the result of multiplying orderqty and price:

  <xsl:sort select="@orderqty * @price" data-type="number" />

I suspect that in XSLT 2.0 there will be more data types based on the
XML Schema built-in data types, so you'll be able to do things like:

  <xsl:sort select="@date" data-type="xs:date" />

However, again it's about the type of the sort value, not the node
that's used to get the sort value, since the sort value might come
from something other than a simple node.
  
Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread