Below is my requirement ,
Input XML :
<ns0:TestDTM xmlns:ns0="http://SchemaIN">
<ID>1234</ID>
<Ref>A1</Ref>
<Detail>
<Qualifier>Q1</Qualifier>
<Value>Name</Value>
</Detail>
<Detail>
<Qualifier>Q2</Qualifier>
<Value>Address</Value>
</Detail>
<Detail>
<Qualifier>Q3</Qualifier>
<Value>AddressType</Value>
</Detail>
</ns0:TestDTM>
Desired OutPut : Header Record will repeat only once
<ns0:Root xmlns:ns0="http://SchemaOUT">
<Header>
<ID>1234</ID>
<Ref>A1</Ref>
<Value1>Name</Value1>
<Value2>Address</Value2>
<Value3>AddressType</Value2>
</Header>
</ns0:Root>
XSLT 1.0 Written :
<?xml version="1.0" encoding="UTF-16"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" version="1.0" xmlns:s0="http://SchemaIN" xmlns:ns0="http://SchemaOUT">
<xsl:output omit-xml-declaration="yes" method="xml" version="1.0" />
<xsl:template match="/">
<xsl:apply-templates select="/s0:TestDTM" />
</xsl:template>
<xsl:template match="/s0:TestDTM">
<ns0:Root>
<xsl:for-each select="Detail">
<Header>
<xsl:choose>
<xsl:when test="Qualifier = 'Q1'">
<Value1>
<xsl:value-of select="Value/text()" />
</Value1>
</xsl:when>
<xsl:when test="Qualifier = 'Q3'">
<Value2>
<xsl:value-of select="Value/text()" />
</Value2>
</xsl:when>
</xsl:choose>
</Header>
</xsl:for-each>
</ns0:Root>
</xsl:template>
</xsl:stylesheet>
The XSLT i have written is not giving the desired output. I need to use xslt 1.0 only.The header in the output repeats only once