Beniamin Tecar wrote:
I have an xml :
<DataRecords>
<Point Alias='A' Value='1' Status='0' />
<Point Alias='B' Value='2' Status='0' />
</DataRecords>
I have needed by an XSL to insert a node between <DataRecords> and <Point>
Example :
<DataRecords>
<Record>
<Point Alias='A' Value='1' Status='0' />
</Record>
<Record>
<Point Alias='B' Value='2' Status='0' />
</Record>
</DataRecords>
Simply use the identity transformation and add one template for <Point>
elements that wraps them into a <Record> element:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="UTF-8" />
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>
<xsl:template match="Point">
<Record>
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</Record>
</xsl:template>
</xsl:stylesheet>
--
Martin Honnen
http://JavaScript.FAQTs.com/