xsl-list
[Top] [All Lists]

Re: [xsl] [XSL] Two "Philisophical" questions about the language

2009-01-18 23:03:04
On 1/18/09, G. Ken Holman <gkholman(_at_)cranesoftwrights(_dot_)com> wrote:
At 2009-01-17 12:23 +0100, Alain wrote:
My second one might be easier!

Let's say I have an XML like this

<?xml version="1.0">
<root>
 <!-- Any number of nodes here -->
</root>

As a valid XML document can have only one "main" node,

Called the "document element".

what is the architectural and practical difference between

<xsl:template select="/">

and

<xsl:template select="/root">

First, it would be match="/" and match="/root", and needing to match
on the document node is important to access the XML prologue and any
content after the document element in the instance:

<?xml version="1.0">
<?xml-stylesheet type="text/xsl" href="over-there.xsl">
<?owner jsmith>
<root>
</root>
<!--copyright notice here-->

The root node in the above document has 4 child nodes.

There is also the case of XML schemas which can have different root
nodes. For example in TEI (http://www.tei-c.org/) we have both TEI
(containing a single text) and teiCorpus (containing a corpus of
texts). "/" will match either of these. "/teiCorpus" or "/TEI" only
match one or the other.

cheers
stuart

--~------------------------------------------------------------------
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>
--~--