[xsl] Nodes between two nodes with the same name (again :-(

Subject: [xsl] Nodes between two nodes with the same name (again :-(
From: "Smirnov, Anatoliy" <anatoliy.smirnov@xxxxxxxxxxx>
Date: Tue, 6 May 2003 08:48:19 -0400
I need to output all nodes between two nodes with the same name, so that
from the node <h> becomes the HEADER and all nodes after <h> until the next
<h> become the BODY. The source file is: 

    <h> Header </h>

    <p> A </p>
      <dt> B </dt>
      <dt> C </dt>

    <h>Header </h>

    <p> D </p>
        <dt> E </dt>
    <p> F </p>


I need to have this output 

   <HEADER> Header </HEADER>
   <HEADER> Header </HEADER>

I found the similar posting on xsl list at 
by Jeni Tennison by have hard time implementing it. My xsl is

<xsl:stylesheet version="1.0"
<xsl:template match="html/body">
<xsl:template match="html/body/h">
     <xsl:value-of select="."/>

and it gives me (numbers for reference only):

2   <ROW>
3   <HEADER> Header </HEADER>
4    <BODY> ABC 
5      <ROW>
6        <HEADER> Header </HEADER>
7        <BODY> DEF </BODY> 
8      </ROW>
9      DEF
10  </BODY>
11  </ROW> 
12  ABC
13  <ROW>
14    <HEADER> Header </HEADER>
15    <BODY> DEF </BODY>
16  </ROW>
17  DEF

with lines 5-9,12,17 that I don't want to be there.

Please, can someone help.
Thank you.

Anatoliy Smirnov
Department of Veterans Affairs

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread