XSLT copying and enriching

O

olivier.scalbert

Hello,

How can I write the XSLT to transform:

<Root>
<Element attribute="value"/>
<Element2>
<Element3/>
</Element2>
</Root>

into:

<Root>
<Element attribute="value"/>
<Element2>
<Element3/>
</Element2>
<New element>
....
</New element>
</Root>

The output is the same as the input with a new element at the end.

Thanks for your help.
Olivier
 
M

Martin Honnen

How can I write the XSLT to transform:

<Root>
<Element attribute="value"/>
<Element2>
<Element3/>
</Element2>
</Root>

into:

<Root>
<Element attribute="value"/>
<Element2>
<Element3/>
</Element2>
<New element>
....
</New element>
</Root>

The output is the same as the input with a new element at the end.

Start with the identity transformation template
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
then add
<xsl:template match="Root">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
<New-Element>
....
</New-Element>
</xsl:copy>
</xsl:template>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,007
Messages
2,570,266
Members
46,865
Latest member
AveryHamme

Latest Threads

Top