I am trying to write XSLT document for the source XML and i do have Traget XML too (what it should look like)
My Source looks like:
<soap:Envelope xmlns:soap="http://ift.tt/sVJIaE" xmlns:xsi="http://ift.tt/ra1lAU" xmlns:xsd="http://ift.tt/tphNwY">
<soap:Body>
<a xmlns="http://ift.tt/vZCHiv">
<b>
<c>
<d>
<e MemberID="1" />
<e MemberID="2" />
<e MemberID="3" />
</d>
</c>
</b>
</a>
</soap:Body>
</soap:Envelope>
What i want to achieve is (Target XML)
<d>
<e ID="1" />
<e ID="2" />
<e ID="3" />
</d>
I have been trying to write my XSLT but couldn't get it working. I have been using some online tools, where i give my source and write XSLT but i am not getting any result. (never worked in XSLT)
Can someone please help me in writing this or point me in write direction.
What i have tried is:
<xsl:stylesheet version="1.0" xmlns:xsl="http://ift.tt/tCZ8VR">
<xsl:template match="/">
<xsl:apply-templates select="a/b/c/d"/>
</xsl:template>
<xsl:template match="d">
<Members>
<xsl:for-each select="e">
<e>
<xsl:value-of select="@MemberID"/> -- I know its wrong, but just want something to work
</e>
</xsl:for-each>
</Members>
</xsl:template>
</xsl:stylesheet>
Thanks
No comments:
Post a Comment