0

Hi peoples,

Suppose I have an XML file

<Application>
  <Segment1>
    <ID>Sam</ID>
    <Fee>2.50</Fee>
    <Fee>1.00</Fee>
  </Segment1>
</Application>

In a nutshell, I want to move the two <Fee> Elements to another section so it looks like this;

<Application>
  <Segment1>
    <ID>Sam</ID>
  </Segment1>
  <Segment2>
    <Fee>2.50</Fee>
    <Fee>1.00</Fee>
  </Segment2>
</Application>

It would invlove deleting the <Fees> from the 1st segment and copying it to segment 2.
Any help would be greatly appreciated.

Thanks in advanced

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by mrame
0

Check if the works:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml"/>

<xsl:template match="Application">
<Application>
	<xsl:apply-templates select="Segment1"/>
	</Application>
</xsl:template>

<xsl:template match="Segment1">
<xsl:copy>
<xsl:copy-of select="ID"/>
</xsl:copy>
<segment2>
<xsl:copy-of select="//Fee"/>
</segment2>
</xsl:template>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.