Next in thread → Next in month →

Re: [docbook-apps] Delete child <section> via xsl

From
Jirka Kosek <>
Date
2012-05-04T19:12:03+00:00
ID
Thread
Re: [docbook-apps] Delete child <section> via xsl
On 3.5.2012 21:39, Joshua Wulf wrote:
> I'd like to apply it once to convert the document to a new structure.

Then you need simple identity transformation which will remove section
with duplicate title, something like:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">

<xsl:template match="node()">
  <xsl:copy>
    <xsl:copy-of select="@*"/>
    <xsl:apply-templates/>
  </xsl:copy>
</xsl:template>

<xsl:template match="section[title = ../title][preceding-sibling::section]">
  <xsl:apply-template select="node()[not(self::title)]"/>
</xsl:template>

</xsl:stylesheet>

Depending on whether you want to keep XIncludes you need to switch
on/off XInclude in parser used by XSLT processor.

				Jirka

-- 
------------------------------------------------------------------
  Jirka Kosek      e-mail:       http://xmlguru.cz
------------------------------------------------------------------
       Professional XML consulting and training services
  DocBook customization, custom XSLT/XSL-FO document processing
------------------------------------------------------------------
 OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 member
------------------------------------------------------------------
Next in thread → Next in month →