XSLT using namespace inside the root element



Ia m trying to create a XSLT file for the below xml.



<?xml version="1.0" encoding="utf-8"?>
<items>

<ListedItemDetail xmlns="http://test.com/v1" xmlns:i="http://ift.tt/ra1lAU">
<ListingId>797188526</ListingId>
</ListedItemDetail>

<ListedItemDetail xmlns="http://test.com/v1" xmlns:i="http://ift.tt/ra1lAU">
<ListingId>7971823</ListingId>
</ListedItemDetail>

</items>


And below is the XSLT file i have created



<xsl:stylesheet version="2.0" xmlns:xsl="http://ift.tt/tCZ8VR" xmlns:xsi="http://ift.tt/ra1lAU" xmlns:t="http://test.com/v1" >

<xsl:template match="items">
<xsl:element name="ListedItemDetail">
<xsl:element name="ListingId">
<xsl:value-of select="ListingId"/>
</xsl:element>


but I can't get it to work for the life of me. Can someone tell me what I am doing wrong?


Thanks,


No comments:

Post a Comment