[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: text nodes of document in XDM

  • From: David Carlisle <davidc@nag.co.uk>
  • To: David Lee <dlee@calldei.com>
  • Date: Tue, 11 Jan 2011 20:17:52 +0000

Re:  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.

David

>


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


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.