[xsl] Display text and all the following nodes except <anchor> and <pb>

Subject: [xsl] Display text and all the following nodes except <anchor> and <pb>
From: "J. S. Rawat" <jrawat@xxxxxxxxxxxxxx>
Date: Fri, 19 Sep 2008 13:18:07 +0530
Sorry for the confusion. I am putting this a fresh thread. Any help is appreciated
INPUT:
<docGroup>
<doc id="FFCP0002-DOC0001">
<head>...</head>
<docBody>
<div type="ss1">
<head>O<sCap>FFICERS</sCap> of the R<sCap>EGIMENT</sCap> of I<sCap>NFANTRY</sCap><anchor id="JHXMA2911"/><pb n="FFCP0002-477"/></head>
...
</div>
<div type="ss1">
<head>
<title>(1) Extract of a <anchor id=".."/><pb n=".."/>Letter from Governor <person>William Blount</person> to the Secretary of State</title>
</head>
...
</div>
</doc>
</docGroup>


XSL:
<xsl:template match="doc">
<ul>
<xsl:for-each select="//docGroup//div[@type='ss1']">
<li><a><xsl:attribute name="href">#sec<xsl:number format="1" count="//docGroup//div[@type='ss1']" level="any" from="docGroup"/></xsl:attribute><xsl:apply-templates select="head" mode="toc"/> </a> </li>
</xsl:for-each>
</ul>
<div id="content">
<xsl:apply-templates/>
</div>
</xsl:template>


<xsl:template match="div/head">
   <xsl:choose>
      <xsl:when test="../@type='ss1'">
         <h2>
            <xsl:apply-templates/>
         </h2>
      </xsl:when>
   </xsl:choose>
</xsl:template>

<xsl:template match="div[@type='ss1']/head" mode="toc">
<xsl:apply-templates select="*[not(name(.)='anchor' or name(.)='pb')]|text()"/>
</xsl:template>


OUTPUT of above XLT:
<ul>
<li><a href="#sec1">O<span class="sCap">FFICERS</span> of the R<span class="sCap">EGIMENT</span> of I<span class="sCap">NFANTRY</span></a></li>
<li><a href="#sec75">(1) Extract of a <a name="..."/><a name=".."/>Letter from Governor William Blount to the Secretary of State</a></li>
</ul>
<h2>O<span class="sCap">FFICERS</span> of the R<span class="sCap">EGIMENT</span> of I<span class="sCap">NFANTRY</span></h2>
<h2>(1) Extract of a <a name=".."/><a name="..."/>Letter from Governor William Blount to the Secretary of State</h2>


REQUIRED OUTPUT:
<ul>
<li><a href="#sec1">O<span class="sCap">FFICERS</span> of the R<span class="sCap">EGIMENT</span> of I<span class="sCap">NFANTRY</span></a></li>
<li><a href="#sec75">(1) Extract of a Letter from Governor William Blount to the Secretary of State</a></li>
</ul>
<h2>O<span class="sCap">FFICERS</span> of the R<span class="sCap">EGIMENT</span> of I<span class="sCap">NFANTRY</span></h2>
<h2>(1) Extract of a <a name=".."/><a name="..."/>Letter from Governor William Blount to the Secretary of State</h2>


Thanks
...JSR


Current Thread