Hi,
I am a beginner in using XSLT. I am having a problem in tranforming an XML element to a fixed position in a message when the position of the corresponding element in the source message is variable.
eg:
XML1:
<personal>
<personalDetails>
<name>
String</name>
<age>String</age>
<address>
<address1>String</address1>
<address2>String</address2>
</address>
</personalDetails>
</personal>
XML2:
<personal>
<personalDetails>
<name>String</name>
<age>String</age>
</personalDetails>
<address>
<address1>String</address1>
<address2>String</address2>
</address>
</personal>
The response XML should look like this
<xsl:template match="address">
<ADDRESS>
<xsl:choose>
<xsl:when test="ancestor:
ersonal">
<ADDRESS1>
<xsl:value-of select="address1"/>
</ADDRESS1>
<ADDRESS2>
<xsl:value-of select="address1"/>
</ADDRESS2>
</xsl:when>
<xsl
therwise>
<ADDRESS1>
<xsl:value-of select="address1"/>
</ADDRESS1>
<ADDRESS2>
<xsl:value-of select="address1"/>
</ADDRESS2>
</xsl
therwise>
</xsl:choose>
</ADDRESS>
</xsl:template>
But the problem it just prints the nodes in what format it comes. Please could anyone suggest a way out of this problem.