Problems parsing XML with XSL in it
When trying to read my xml from a webpage i get: "Error: At line 8, column 23: unbound prefix" Below is my xml:
<?xml version="1.0"?>
<outertag>
<innertag sampleattri开发者_如何学Gobute="innertagAttribute">
<Retailer>
RetailerName:
<xsl:template match="link">
<a href="LinkGoesHere">Link</a>
</xsl:template>
</Retailer>
</innertag>
Any ideas as to what is wrong? Can I not use xsl:template within my xml? Any help is greatly appreciated.
When trying to read my xml from a webpage i get: "Error: At line 8, column 23: unbound prefix" Below is my xml:
<?xml version="1.0"?> <outertag> <innertag sampleattribute="innertagAttribute"> <Retailer>RetailerName: <xsl:template match="link"> <a href="LinkGoesHere">Link</a> </xsl:template> </Retailer> </innertag> </outertag>
Any ideas as to what is wrong? Can I not use xsl:template within my xml?
The provided document is not well-formed and the error message very well says what is the reason:
There is an element named xsl:template
, however there is no namespace declaration in the whole document that binds the prefix xsl:
to any namespace.
Solution:
Correct the non-well-formed text to a well-formed XML document by providing a namespace declaration for the XSLT namespace:
<outertag>
<innertag sampleattribute="innertagAttribute">
<Retailer>RetailerName:
<xsl:template match="link"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<a href="LinkGoesHere">Link</a>
</xsl:template>
</Retailer>
</innertag>
</outertag>
精彩评论