Re: [xsl] Can a single XPath statement duplicate the functionality of this verbose <xsl:choose> statement?

Subject: Re: [xsl] Can a single XPath statement duplicate the functionality of this verbose <xsl:choose> statement?
From: "Mark" <mark@xxxxxxxxxxxx>
Date: Mon, 24 Oct 2011 18:00:16 -0700
Hi Michael,
Well that helps - I thought it was just me that was muddled ;-)
Thanks,
Mark

-----Original Message----- From: Michael Kay
Sent: Monday, October 24, 2011 4:33 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Can a single XPath statement duplicate the functionality of this verbose statement?



I still do not understand, for instance, the emphasis in the literature in distinguishing between the "root" and "the document node"; it seems not to have any impact on writing code. On the other hand, learning about result tree serialization will alter my code (I hope). Makes me wonder which other primitive XSLT notions would be as useful...


The terminology in the specs is just muddled here.


There's a node D representing the document, and a node E representing
the outermost element.

D is sometimes called the document node, sometimes the root.

E is sometimes called the document element, sometimes the root element.
(I call it the outermost element!)

Different specs use different terms, but the concepts are the same.

Note that in the XDM model used by XPath 2.0 and XSLT 2.0:

(a) a document node can have multiple element children

(b) any node (document nodes, element nodes, even text nodes) can be
parentless, and thus be the root of a tree

although neither of these conditions will arise in a tree that results
from parsing well-formed XML.

Michael Kay
Saxonica

Current Thread