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

Re: Display text and all the following nodes except <

Subject: Re: Display text and all the following nodes except <anchor> and <pb>
From: George Cristian Bina <george@xxxxxxxxxxxxx>
Date: Fri, 19 Sep 2008 11:10:11 +0300
Re:  Display text and all the following nodes except  <
Your sample are not good, the input is not well formed and the output you say you obtain cannot be obtained from the stylesheet you posted (for example the stylesheet generates a div element that does not appear in your output.
Try posting complete and correct samples otherwise people need to spend most of the time fixing your samples than helping you solving your problem.


Best Regards,
George
--
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

J. S. Rawat wrote:
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

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.