|
Subject: Re: [xsl] Moving (promoting) XML elements through XSL From: "Mark Peters" <flickrmeister@xxxxxxxxx> Date: Fri, 30 Jun 2006 09:33:39 -0400 |
BTW, this is never needed in a pattern. Just write "topic".
I celebrated too soon. When I apply the stylesheet against my input file, I get the title, prolog, and body elements on the same level -- which is the desired result -- but title appears below prolog, which is invalid against the DTD I'm working with. How could I output the title element above the prolog element?
<?xml version="1.0"?>
<topic>
<title>
<indexterm>Software Requirements</indexterm>Software Requirements
</title>
<body>
<p>Some sample text</p>
</body>
</topic><?xml version="1.0"?>
<topic>
<prolog>
<metadata>
<keywords>
<indexterm>
<indexterm>Software Requirements</indexterm>
</indexterm>
</keywords>
</metadata>
</prolog>
<title>
<indexterm>Software Requirements</indexterm>Software Requirements
</title>
<body>
<p>Some sample text</p>
</body>
</topic><?xml version="1.0"?>
<topic>
<title>
<indexterm>Software Requirements</indexterm>Software Requirements
</title>
<prolog>
<metadata>
<keywords>
<indexterm>
<indexterm>Software Requirements</indexterm>
</indexterm>
</keywords>
</metadata>
</prolog>
<body>
<p>Some sample text</p>
</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"/>
</indexterm>
</keywords>
</metadata>
</prolog>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template> <xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Thanks, Mark
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Moving (promoting) XML el, David Carlisle | Thread | Re: [xsl] Moving (promoting) XML el, David Carlisle |
| Re: [xsl] Moving (promoting) XML el, David Carlisle | Date | Re: [xsl] Moving (promoting) XML el, David Carlisle |
| Month |