[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Novice Question - matching entire text children


Subject: Re: [xsl] Novice Question - matching entire text children
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Mon, 20 Dec 2010 14:16:30 +0100

David Lee wrote:
XSLT 2.0
I have a problem (probably my own misuse of XSLT) but I run into cases where

<xsl:template  match="NODE/text()">

</xsl:template>

can match more then once in a row.   I have not debugged this yet to
determine if something more complex is really the culprit (probably is),
and the text nodes matched seem to be whitespace  " \n\t .."
But before I really start digging maybe someone could tell me offhand what
the *expected* behaviour is ?

If I have an element lik
                 <ELEM>
   some

Text
Here</ELEM>


is <xsl:template match="NODE/text()">

*supposed* to be called once and only once with the entire text children or
is it possible that it is called multiple times with chunks of data as the
processer sees fit. ?

Well if you have an element named "ELEM" then a match="NODE/text()" does not apply at all.
If you had match="ELEM/text()" then the template would apply to the single text child node of above "ELEM" element.
But you could have
<ELEM>some text
<child>...</child>
some more text
<child>...</child>
and some more text
</ELEM>
in that case there are three text child nodes of the ELEM element the template could be applied to.




--

	Martin Honnen
	http://msmvps.com/blogs/martin_honnen/


Current Thread