RE: [xsl] [OT]

Subject: RE: [xsl] [OT]
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 29 Feb 2008 11:41:03 -0000
> I am curious, what is the use of function, data() in XPath 
> 2.0; from stylesheet writer's perspective ?
> 
> As defined in the spec, data() function retrieves the typed 
> value of the argument passed. The typed value (of say, a 
> node) to me is more useful within the processor and not very 
> much to the end user ...


It's very rarely necessary to call data() explicitly, because atomization is
nearly always done automatically when needed. But there are occasions for
using it, especially with schema-aware processing.

<xsl:if test="@married">

does not mean the same as

<xsl:if test="data(@married)">

because the effective boolean value of a node is always true, regardless of
its typed value.

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

Current Thread