I've been trying to convert my xml using xslt and it's driving me nuts.
Here is the XML,
<env:Body xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<items xmlns="http://ws.apache.org/ns/synapse">
<profiles>
<candidate_details>
<application>
<app_id>ABC</app_id>
<position_id>RR</position_id>
</application>
</candidate_details>
<candidate_details>
<application>
<app_id>ABC2</app_id>
<position_id>RR2</position_id>
</application>
</candidate_details>
</profiles>
</items>
</env:Body>
And here is XSLT
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:env="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="no"/>
<xsl:template match="env:Body/items/profiles">
<xsl:for-each select="candidate_details">
<application>
<app_id> <xsl:value-of select='application/app_id' /> </app_id>
</application>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
My expected output is
<application>
<app_id>
ABC
</app_id>
</application>
<application>
<app_id>
ABC2
</app_id>
</application>
It doesn't print out this format at all, but only the values, what am I doing wrong? Please help. Thanks!
PS. I'm aware that
<items xmlns="http://ws.apache.org/ns/synapse">
is invalid namespace, but that's how the xml is coming, so I have to use this xml as input.