I have to transform xml file with few attributes under a root to XML using xslt i could achive that for single root occurence but my input xml will contain multiple records(occurences of root & its subnodes with different values) how to add looping so that after completing parsing of first root goes to its next accourence. Below is the input XML
Input XML
<Information>
<Name>Joe</Name>
<DOB>01012014</DOB>
</Information>
<Information>
<Name>Mark</Name>
<DOB>12012012</DOB>
</Information>
XSLT:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/>
<xsl:template match="/">
<xsl:element name="Information">
<xsl:apply-templates select="Information/Name"/>
<xsl:apply-templates select="Information/DOB"/>
</xsl:element>
</xsl:template>
<xsl:template match="Information/Name">
<xsl:element name="Name">
<xsl:value-of select="."/>
</xsl:element>
</xsl:template>
<xsl:template match="Information/DOB">
<xsl:element name="DOB">
<xsl:value-of select="."/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Output: Basically need to reorder DOB first then name and process both the root nodes information
<Information>
<DOB>01012014</DOB>
<Name>Joe</Name>
</Information>
<Information>
<DOB>12012012</DOB>
<Name>Mark</Name>
</Information>
Any help greatly appreciated.