[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Matching only text nodes with certain (complicated) p

Subject: Matching only text nodes with certain (complicated) properties
From: "David B?rgin" <david.buergin@xxxxxxxxxxxxx>
Date: Fri, 09 Jan 2009 18:07:47 +0100
 Matching only text nodes with certain (complicated)  p
Hello list!

There's this matching problem I cannot solve:

In one template of my XSL stylesheet I'd like to match a text node with certain properties. Namely, the template should match for any text node where the nearest preceding non-empty text node is farther away than (= comes before) the nearest preceding <pb/> (page-break milestone element).

I'll give you some context on what I'm trying to do: I have a TEI P5 document (http://www.tei-c.org/), where page breaks are indicated by milestone elements of the form <pb n="[number]"/>. These can occur anywhere.
From this TEI document, I'd like to generate XHTML with the <pb/> elements,
of course, removed, but now represented as a <span> containing the page number at the very beginning of the next text node. (In the browser presentation, this <span> would then be floated outside regular flow -- using CSS -- as page indicators in the margin of the page ... is what I'd planned to do, at least)

Here's an example fragment from the source document (here with a list inside another list):

 before a vowel.
 <pb n="26"/>
   <item n="a">The <mentioned>thingy</mentioned>

I'm trying to match nodes such as "The " in the last line of the example, where the nearest preceding text node "before a vowel." is farther away than the nearest preceding <pb/>, "<pb n="26"/>". Before "The " I would then insert my <span>, "<span>Page <xsl:value-of select="[select preceding pb/@n]/></span>". In this way, the page break information would effectively be moved to right before the next following text node, everywhere.

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.

I found related questions in the archive but nothing that would help, so I appreciate any help very much.

David B|rgin

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.