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

Re: Selecting between heading tags in XHTML

Subject: Re: Selecting between heading tags in XHTML
From: "Eliot Kimber ekimber@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 30 Oct 2014 19:34:41 -0000
Re:  Selecting between heading tags in XHTML
This type of problem can also be solved more clearly or easily a
multi-pass process, for example, doing the group-starting-with to add some
wrapper around each group, making it then easier to analyze the groups to
put them into some hierarchy or select things from them or whatever.

In the Word-to-DITA transform in the DITA for Publisher project I have
about 4 phases of analysis applied against the initial Word structures in
order to translate it into the same content grouped hierarchically based
on a style-to-level mapping specification. It makes heavy use of recursive
for-each-group, where each group represents a hierarchical level assigned
to "heading" pargraphs (in this case, things that would eventually map to
topics in the final DITA result).

Cheers,

E.
bbbbb
Eliot Kimber, Owner
Contrext, LLC
http://contrext.com




On 10/30/14, 1:47 PM, "Michael Kay mike@xxxxxxxxxxxx"
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

>There's no direct way of selecting all nodes on an axis until some
>condition.
>
>The best solution is rather context dependent, e.g. are you in XSLT 1.0
>or XSLT 2.0 or standalone XPath. It may also depend what you want to do
>with the nodes, e.g. apply-templates to them.
>
>One solution in XPath 2.0 is
>
>following-sibling::* except following-sibling::h1/following-sibling::*
>
>But it's not necessarily the most efficient.
>
>Michael Kay
>Saxonica
>mike@xxxxxxxxxxxx
>+44 (0) 118 946 5893
>
>
>
>
>On 30 Oct 2014, at 18:35, Mark Giffin m1879@xxxxxxxxxxxxx
><xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
>> I want to select all siblings between heading tags in an XHTML file, as
>>shown below.
>>
>> <div>
>>    <h4>my heading</h4> <<<---- select from this sibling
>>    <ol>
>>      <li></li>
>>    </ol>
>>    <p></p>
>>    <p></p>
>>    <p></p>
>>    <ul>
>>      <li></li>
>>    </ul>      <<<<---- all the way down to this sibling
>>    <h1></h1>  <<<<---- Do not select this sibling or anything after it
>>    <p></p>
>>    etc.
>> </div>
>>
>> Given the context of <h4> above, I figure that
>>
>> following-sibling::*[some predicate here]
>>
>> would do this but I haven't guessed what would exclude the <h1> (or
>><h2>, etc.) and everything that follows it. What's a good way to do this?
>>
>> Thanks,
>> Mark

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.