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

By the way, I can only use xml version 1.

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>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.