OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] text nodes of document in XDM

On 11/01/2011 18:19, David Lee wrote:
> Thanks very much for this explanation.
> Do you (or anyone) know

well I'm not on the xsl wg (but been followingthen since before xslt 
1:-) so don't take this as a definitive "why" but I can offer some reasons.

 > why with XQuery and XSLT 2 .0 and XPath 2.0 using
> XDM as the data model instead of INFOSET, why a simple sequence isn't used
> for this purpose ?

Infoset came many years after xslt and isn't really a datamodel of the 
right level it doesn't model namespaces quite how xpath needs, and 
models entity types and other things that xpath doesn't distinguish.

> That is why create a document node with<xsl:variable>  when a sequence seems
> the more obvious choice (to me).

xslt1 didn't have parentless element nodes or sequences so it needed a 
container and a root (document) node but even without that, having a 
document node with many children is natural in many environments even 
though it doesnt correspond to a well formed document.
DOM scripting or xslt/xquery make it very easy to generate such 
structures. Also if you have a sequence of element nodes they are not 
always easy to process for example they are not siblings of each other 
and they are not selected by * as that is short for child::* and 
parentless elements are not children. So having them as children of a 
document node simplifies processing greatly.

> Similar for serializing external parsed entities.   To *me*  a "document" is
> NOT "exactly what you want" ... rather a simple sequence.
> Is this for backwards compatible to the INFOSET based XSLT1.0 and XPath 1.0

xpath 1 wasn't really based on the infoset but an earlier version of XDM 
that was specified inline in the xpath 1 spec, As above it is natural in 
xslt 2 or xquery as well as xslt 1 to have templates generating more 
than one element.
> ?
> Or is there a reason, within the XDM model itself, why documents should be
> allowed to have mixed content ...

As above it simplifies Xpath processing of the elements.
> e.g. why is this allowed or "exactly what you want"
> document { "1" , 2.5 ,<foo/>  , text { " text " }  ,<bar/>  }
> If this is purely for generation of external parsed entities, and the
> following sequence produces the same result, why allow anything but a single
> root element in documents
> ( "1" , 2.5 ,<foo/>  , text { " text " }  ,<bar/>  )

the outer level document node constructor  is almost always implicit, 
which simplifies things and it wouldn't really be possible to do that if 
having two items was an error.
> Thanks for any insight.



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS