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

copy part of the original document

Subject: copy part of the original document
From: "Stefan Thull" <stefan@xxxxxxxxxx>
Date: Mon, 30 Dec 2002 22:52:50 +0100
xsl copy part
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

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.