[xsl] Copying-Replacing Elements

Subject: [xsl] Copying-Replacing Elements
From: "Emerson, Matt" <Matt.Emerson@xxxxxxx>
Date: Thu, 1 Sep 2005 17:43:44 -0400
Hello,

When I encounter a node that specifies some criteria in a document, I
would like to make a few changes to it (which could include adding,
deleting, and updating members) and output it and then output the
original node.

Could someone tell me the best of way of accomplishing this?

The original node would look something like this...
<data>
	<cell id="8" flag="false">
		<name>bob</name>
		<member>5</member>
	</cell>
</data>

The output would like something like this...
<data>
	<cell id="8" flag="true">
		<name>matt</name>
	</cell>
</data>
<data>
	<cell id="8" flag="false">
		<name>bob</name>
		<member>5</member>
	</cell>
</data>

I'm thinking the xsl would look something like this
<xsl:template name="createNewSiblingMember" match="something that
returns a single node">
	<xsl:copy-of select=".">
		...do some kind of transformations...
	</xsl:copy-of>
	<xsl:copy-of select="."/>
</xsl:template>

Thanks for any help that anyone could provide,

Matt

Current Thread