[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: formatting for breaking paragraph-xpath question
> If a paragraph contains a pgbreak, I want the first half of the paragraph > to have an indent, but the part after the pgbreak should not becasue it > isn't the beginning of the paragraph, just the continuation. (there may be > other tags, not just text before the <pgbreak/>) > > How do I grab everything before the <pgbreak/> as one block and after the > <pgbreak/> as a separate block? > > I thought this xpath would work, but it doesn't. > p[child::pgbreak]/node()[preceding::pgbreak] > It grabs all nodes within the paragraph, not sure why. > > Any ideas? Is there another way to do this (without revising the XML :-)? How about p[pgbreak]/node()[following-sibling::pgbreak] for the before nodes, and p[pgbreak]/node()[preceding-sibling::pgbreak] for the after nodes? preceding-sibling::pgbreak restricts the search for the pgbreak to one particular p. preceding::pgbreak doesn't restrict the search that way; as a result, in a structure like this -- <p>Hello<pgbreak/>Goodbye</p> <p>Thanks<pgbreak/>You're welcome</p> -- all children of the second p show up as having a preceding::pgbreak, even though only (in that p) the text node containing "You're welcome" has a preceding-sibling::pgbreak. (Clearly this won't work if paragraphs contain multiple pgbreaks -- in that case, nodes between the first and the last pgbreaks would be found in both sets. It also won't work if pgbreaks can be lower-level descendants of paragraphs, rather than just children.) hth... -- ed XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|