[xsl] copy part of the original document

Subject: [xsl] copy part of the original document
From: "Stefan Thull" <stefan@xxxxxxxxxx>
Date: Mon, 30 Dec 2002 22:52:50 +0100
Hello
I have a document which has different sections.
Each section has an element, called heading.
I want to copy the whole document, as it is, except when the heading of a
section has an attribute (name="Entwurf"). Then this section and all its
children should not be copied.

Here is an example:
<?xml version="1.0" encoding="UTF-8" ?>
<!--
This document was converted from RTF source by upCast Private Edition (c)
1999-2002 <www.infinity-loop.de>
 -->
<document>
<documentinfo>
  <property name="author" value="Stefan Thull" />
  <property name="numberOfCharsWS" value="17111" />
</documentinfo>

<part>
  <section level="1">
    <heading level="1" name="Title"> Titel</heading>
  </section>
  <section level="1">
    <heading level="1" name="Entwurf">Ideen: </heading>
    <section level="2">
      <heading level="2" name="Stichwort">Stichwort:</heading>
    </section>
    <section level="2">
      <heading level="2" name="heading_2"></heading>
      <Normal>text ... </Normal>
      <section level="3">
        <heading level="3" name="heading_3"> text</heading>
        <Normal> text text in level 3</Normal>
      </section>
     </section>
  </section>
<section level="1">
    <heading level="1" name="heading_1"> Thema   </heading>
	<section level="2">
      <heading level="2" name="heading_2"> header 2</heading>
      <Normal> text text text</Normal>
  </section>
</section>
</part>
...

I have tried it with something like:
<xsl:template match="section[heading/@name='Entwurf']">
  <xsl:copy-of select="..">

        <xsl:apply-templates select="*|@*|processing-instruction()|text()"/>
  </xsl:copy-of>
</xsl:template>
<xsl:template match="*|@*|processing-instruction()|text()"/>
<xsl:copy>
  <xsl:apply-templates select="*|@*|processing-instruction()|text()"/>
</xsl:copy>
</xsl:template>

But the parser (4xslt) says, "Illegal child 'xsl:apply-templates' within
element 'xsl:copy-of'"

Thank you for any help.

Stefan Thull



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


Current Thread