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

Building a new tree

Subject: Building a new tree
From: Bovone Stefano <Stefano.Bovone@xxxxxxxx>
Date: Tue, 13 Apr 1999 16:01:21 +0200
d2 building tree
Title: Building a new tree

I have, for example, the following XML document:

<?xml version="1.0"?>

<document>
        <common id="D1">
          <p>First common part A</p>
          <p>First common part b</p>
            </common>

        <common id="D2">
          <title>SECOND COMMON PART</title>
        </common>

        <letter>
          <doc>
          <title> THE DOCUMENT </TITLE>
          <p> generic text</p>
          <insert_common ref="D1"/>
          <p> generic text</p>
          <insert_common ref="D2"/>
              </doc>
             </letter>
</document>

and I want using a XSL document to have:

<?xml version="1.0"?>
  <doc>
          <title> THE DOCUMENT </TITLE>
          <p> generic text</p>
          <p>First common part A</p>
          <p>First common part b</p>
          <p> generic text</p>
          <title>SECOND COMMON PART</title>
   </doc>
            
I thought to use:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http:/www.w3.org/TR/WD-xsl">

<xsl:template match="/">
 <xsl:template select=".//letter"/>
</xsl:template>

<xsl:template match="letter">
  <xsl:apply-templates/>
</xsl:template>

<xsl:template match="letter/* | letter//*">
 <xsl:copy>
  <xsl:apply-templates select="text() | @* | * | ./* | insert_common"/>
 </xsl:copy>
</xsl:template>

<xsl:template match="insert_common">
  <xsl:apply-templates select="id(@ref)/tag"/>
</xsl:template>

<xsl:template match="tag/*">
 <xsl:copy>
  <xsl:apply-templates select="text() | * | ./*"/>
 </xsl:copy>
</xsl:template>

</xsl:stylesheet>      


but it doesn't work.

Have anybody any idea ?

Thanks. Bye.

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.