I have an xml doc and an xsl doc. Recently, the service that provides that xml has added an xmlns to the rootnode, and now my xsl doesn't work. Here is an example of what's happening:
test.xml:
test.xsl:
Which works fine, but when the xml contains a namespace the xsl does nothing:
What do I need to add to my xsl to read this namespace?
Thanks!
test.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="test.xsl"?>
<result>
<person firstName="Mark" lastName="Smith"/>
<person firstName="Jimmy" lastName="John"/>
</result>
test.xsl:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="[URL unfurl="true"]http://www.w3.org/1999/XSL/Transform"[/URL] targetNamespace="[URL unfurl="true"]http://localhost">[/URL]
<xsl:template match="/">
<html>
<body>
<table border="0" cellspacing="0" cellpadding="5">
<xsl:for-each select="/result/person">
<tr>
<td valign="top"><xsl:value-of select="position()"/>.</td>
<td valign="top"><xsl:value-of select="@firstName"/></td>
<td valign="top"><xsl:value-of select="@lastName"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Code:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="test.xsl"?>
<result xmlns="[URL unfurl="true"]http://localhost">[/URL]
<person firstName="Mark" lastName="Smith"/>
<person firstName="Jimmy" lastName="John"/>
</result>
What do I need to add to my xsl to read this namespace?
Thanks!