[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Selecting between heading tags in XHTML

Subject: Re: [xsl] Selecting between heading tags in XHTML
From: "G. Ken Holman g.ken.holman@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 30 Oct 2014 18:41:33 -0000

At 2014-10-30 18:35 +0000, Mark Giffin m1879@xxxxxxxxxxxxx wrote:
I want to select all siblings between heading tags in an XHTML file, as shown below.

    <h4>my heading</h4> <<<---- select from this sibling
    </ul>      <<<<---- all the way down to this sibling
    <h1></h1>  <<<<---- Do not select this sibling or anything after it

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?

If you are using XSLT 2.0, use grouping with the group-starting-with= attribute. There is helpful information on pages 443 to 446 of my XSLT book that is available for free download on a "try and buy" basis at http://www.CraneSoftwrights.com/training/#ptux ... if you decide not to pay for the book, please delete the copy that you download for free.

If you are using XSLT 1.0, it can be done with keys. That isn't in the book, so let us know if you are constrained to XSLT 1.0.

I hope this helps.

. . . . . . . Ken

-- Public UBL and code list hands-on classes - Stockholm, Dec. 3&4,2014 | Contact us for world-wide XML consulting and instructor-led training | Free 5-hour lecture: http://www.CraneSoftwrights.com/links/video.htm | Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ | G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx | Google+ profile: http://plus.google.com/+GKenHolman-Crane/about | Legal business disclaimers: http://www.CraneSoftwrights.com/legal |

--- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com

Current Thread