On 05/03/2008, Michael Kay <mike(_at_)saxonica(_dot_)com> wrote:
> ...which is a bit odd to me at the moment. It seems a bit of
> an artificial restriction.
>
The basis for the distinction is the theory that with mixed content, it
makes sense to treat the markup as mere decoration of the text, whereas with
element-only content, concatenating the children is a meaningless operation.
In both cases I think the assumption is probably correct 95% of the time,
and in the 5% of cases where it's wrong, the rule doesn't do much harm.
That's a nice way of putting it.
It is slightly funny though, that given:
<data>
<somedata>important data</somedata>
<somedata>even more important data</somedata>
</data>
calling data() on that results in an error, and that's at the request
of the data heads.
Intuitively (for me at least) I would expect it to concatenate the
data items with a space separator. Where the content was mixed, you
wouldn't need the separator.
Perhaps the data() function should be avoided - just use the
appropriate constructor instead. For example, the data(@married)
example[1] - as long as @married is typed then test="data(@married)"
will work as expected. If it's untyped and @married="false" then
data(@married) returns true, so the result will change depending on
whether the source has been validated or not.
If however you do test="xs:boolean(@married)" then it works as
expected regardless of validatation.
[1] http://schema-aware.com/xslt/data-function.html
--
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/
--~------------------------------------------------------------------
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>
--~--