Re: differentiation between text() and entities???

Subject: Re: differentiation between text() and entities???
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 15 Jun 2000 13:42:12 +0100 (BST)
> What?  XSLT requires that all continuous text is in one continuous
> text NODE?

It isn't a restriction on the input, just a way the source tree is
modelled.

A document that looks like

<a>123<b/>456</a>

a root node
  an element node with name a
    a text node with value 123
    an element node with name b
    a text node with value 456


so any adjacent characters are clumped together into text nodes and
matched by text()

This is distinct from a grove model where each character is a node that
has its own properties that may be set/queried independently

ie the above would produce a bigger tree

a root node
  an element node with name a
    a character node with value 1
    a character node with value 2
    a character node with value 3
    an element node with name b
    a character node with value 4
    a character node with value 5
    a character node with value 6


the effect of this in XSLT is that you can not match directly onto the
'2' you have to get hold of the text node and then use the substring
function to break that apart.

But note that entity expansion happens before any of this, so
<a>1&nbsp;3<b/>456</a>
still just has two text nodes, each containing a three character string,
but now the first text node has a non breaking space instead of a 2.


David


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread