xsl-list
[Top] [All Lists]

[xsl] Use of data() function (was: Re: [xsl] [OT])

2008-02-29 09:00:35
Hi Mike,
  Thanks for the explanation.

Related to your points, I have few doubts and would be grateful, if
you could explain this to me ...

You wrote
<xsl:if test="@married">

I think, this test will always return true. I used to read this as:
test if this attribute on the context node(the element) exists. You
say, we are testing the (effective) boolean value of the node (which
sounds good to me ...)

What exactly is meant by "effective boolean value" ? Is it the
resultant boolean value of the expression after all structural
normalizations?

How should this be exactly interpreted:
<xsl:if test="data(@married)">

Should I read this as: We are testing if the typed value of the node
(the attribute node here) is true or false. Let's say, string value of
@married attribute is 'yes' (and not the normal idioms of boolean,
like true/1 or false/0), what does

xsl:if test="data('yes')"
or
xsl:if test="data(xs:string('yes'))"

do?

Hope you could understand my confusion ...


On Fri, Feb 29, 2008 at 5:11 PM, Michael Kay <mike(_at_)saxonica(_dot_)com> 
wrote:
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/



-- 
Regards,
Mukul Gandhi

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>