Re: [xsl] Moving (promoting) XML elements through XSL

Subject: Re: [xsl] Moving (promoting) XML elements through XSL
From: "Mark Peters" <flickrmeister@xxxxxxxxx>
Date: Thu, 29 Jun 2006 19:39:44 -0400
The script worked for you?  That's odd. I tried it, but my processor
returned the same results as before. My output file still displays the
title and body subnodes inside the topic element, but the script
deletes the indexterm element.

<?xml version="1.0" encoding="utf-8"?>
<topic id="i267011">
 <title>Software Requirements
    </title>
 <body>
  ..
    </body>
</topic>


<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
       <xsl:output indent="yes"/>
       <xsl:template match="/topic">
               <xsl:copy>
                       <xsl:apply-templates select="@*"/>
                       <prolog>
                               <metadata>
                                       <keywords>
                                               <xsl:copy-of
select="title/indexterm"/>
                                       </keywords>
                               </metadata>
                       </prolog>
                       <xsl:apply-templates select="node()"/>
               </xsl:copy>
       </xsl:template>
       <xsl:template match="indexterm"/>
       <xsl:template match="@*|node()">
               <xsl:copy>
                       <xsl:apply-templates select="@*|node()"/>
               </xsl:copy>
       </xsl:template>
</xsl:stylesheet>

It looks like the script should work. I'm confounded as to why it doesn't.


Thanks,
Mark

Current Thread