[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Actually Dimitre, as long as this is TEI as the OP stated, the pb will never be an ancestor -- it'll always be on preceding axis. (As the OP noted in passing, it's a milestone -- always empty. :-)
At 01:08 PM 1/9/2009, Dimitre wrote:
...
Re: [xsl] Matching only text nodes with certain (complicated) properties
Subject: Re: [xsl] Matching only text nodes with certain (complicated) properties From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Fri, 09 Jan 2009 14:28:09 -0500 |
Actually Dimitre, as long as this is TEI as the OP stated, the pb will never be an ancestor -- it'll always be on preceding axis. (As the OP noted in passing, it's a milestone -- always empty. :-)
Cheers, Wendell
At 01:08 PM 1/9/2009, Dimitre wrote:
> In XSLT 1.0 the problem is nastier and expensive, although doable. But when > restricted to 1.0, one should keep in mind other options (such as judicious > pre-processing) to alleviate problems either with performance or code > complexity. > > It's doable because the pb can in fact be found on preceding:: (even when > not on preceding-sibling::).
As the OP stated in his opening message,
"As far as I understand it, the main problem is that the expression I have to construct for matching can't rely simply on the preceding:: or ancestor:: axes since the <pb/> can really appear anywhere in the tree."
The following XSLT 1.0 transformation has a template that correctly matches (only) the required text nodes:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:strip-space elements="*"/>
<xsl:template match="text()"/>
<xsl:template match=
"text()
[count(preceding::text()[1]/preceding::node()
| preceding::text()[1]/ancestor::node()
)
<
count((preceding::pb[1] | ancestor::pb[1])[last()]/preceding::node()
|
(preceding::pb[1] | ancestor::pb[1])[last()]/ancestor::node()
)
]
...
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Matching only text nodes , Dimitre Novatchev | Thread | Re: [xsl] Matching only text nodes , Dimitre Novatchev |
Re: [xsl] Matching only text nodes , Wendell Piez | Date | Re: [xsl] Matching only text nodes , Dimitre Novatchev |
Month |