I have an xml with the following structure:
<FlightDetails>
<CouponNumber>1</CouponNumber>
<ServiceClass>Y</ServiceClass>
</FlightDetails>
<FlightDetails>
<CouponNumber>2</CouponNumber>
<ServiceClass>Y</ServiceClass>
</FlightDetails>
<FlightDetails>
<CouponNumber>3</CouponNumber>
<ServiceClass>Y</ServiceClass>
</FlightDetails>
The xslt used is :
<FlightDetails>
<xsl:for-each select="FlightDetails/CouponNumber">
<CouponNumber>
<xsl:value-of select="." />
</CouponNumber>
</xsl:for-each>
<xsl:for-each select="FlightDetails/ServiceClass">
<ServiceClass>
<xsl:value-of select="." />
</ServiceClass>
</xsl:for-each>
</FlightDetails>
The transformation of the xml to an output xml using the xslt shows:
<FlightDetails>
<CouponNumber>1</CouponNumber>
<CouponNumber>2</CouponNumber>
<CouponNumber>3</CouponNumber>
<ServiceClass>Y</ServiceClass>
<ServiceClass>Y</ServiceClass>
<ServiceClass>Y</ServiceClass>
</FlightDetails>
However, the required output xml should look like:
<FlightDetails>
<CouponNumber>1</CouponNumber>
<ServiceClass>Y</ServiceClass>
</FlightDetails>
<FlightDetails>
<CouponNumber>2</CouponNumber>
<ServiceClass>Y</ServiceClass>
</FlightDetails>
<FlightDetails>
<CouponNumber>3</CouponNumber>
<ServiceClass>Y</ServiceClass>
</FlightDetails>
How to modify the XSLT to achieve the above output xml structure?
<xsl:template match="/"><xsl:copy-of select="*></xs;</template>
, but is that what you want? – oerkelens