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

Re: [xsl] using copy-of and substring-ing retaining child elements


Subject: Re: [xsl] using copy-of and substring-ing retaining child elements
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 23 Nov 2006 17:34:30 GMT

I think the faq has examples of this.

Just use apply-templates with a default "identity" template, and then
specific templates for things that you don't want to copy.

So in your case you want to do something with text nodes, so that;s

<xsl:template match="p/text()"> 
or
<xsl:template match="p//text()"> 
depending on whether you just want to look in the first level or any
text inside any element in a p.


counting chars across the element hierarchy can be tricky, but possible,
or perhaps you can just get away with an approximation such as


<xsl:template match="p/node()[string-length(preceding-sibling::node())&gt;100]"/> 

which zaps all children of the p, after a while.

David


Current Thread