This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: formatting for breaking paragraph-xpath question
- To: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] formatting for breaking paragraph-xpath question
- From: Ed Blachman <EdB at trellix dot com>
- Date: Mon, 24 Sep 2001 13:19:59 -0400
- Reply-To: xsl-list at lists dot mulberrytech dot com
> 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