Re: [xsl] position last and attributes

Subject: Re: [xsl] position last and attributes
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 20 Sep 2012 22:05:37 +0100
On 20/09/2012 19:54, Ihe Onwuka wrote:

[please don't take things off list]

> I don't find it useful to divorce  the concepts of order and
> predictability but it's not so much whether @* is ordered (I am been
> guilty of loose terminology here) but whether the set of attributes in
> the relevant element of the document are because that is what @*
> purports to represent.

The sequence of attribute nodes in the XDM tree _is_ ordered and that's what @* queries. the XDM tree might not have been produced by parsing markup. If you go

<xsl:variable name="x">
<foo>
<xsl:attribute name="a" select="'a'"/>
<xsl:attribute name="b" select="'b'"/>
<xsl:attribute name="c" select="'c'"/>
</foo>
</xsl:variable>

then foo has three attributes in order a b c and if you go $x/foo/@*[last()] then you will get attribute c. The attributes are in order, that order doesn't change during the lifetime of the transformation and
the last of those attributes has name and value c.


What is the case is that (unlike element ordering) the ordering or attribute and document nodes can not be directly related to the order of markup in a serialisation of the tree. the system might serialise $x as

<foo b="b" c   =    "c"
a
=
'a'
></foo     >




> > What then is the faithfulness of the representation if it qualities > can be imputed to it that are not in inherent in the artefact being > represented.


When producing an XDM tree out of a collection of XML documents some properties (such as the document encoding, choice of " or ' around attribute values, order of attribute markup, are lost and some properties (including order or document and attribute nodes)


David

Current Thread