Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error loading stylesheet: Parsing an XSLT stylesheet failed

Tags:

xml

xslt

xpath

This is my xml file:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="hello.xsl"?>
<message>
    <greeting>Hello World!</greeting>
</message>

And this is my xsl file:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/Transform">
<xsl:template match="/">
<html>
<body>
<h1><xsl:value-of select="message/greeting"/></h1>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

When I run the xml file in firefox it gives "Error loading stylesheet: Parsing an XSLT stylesheet failed." error. I am new to xml please can anyone tell me what is the error. And can you tell me a way to find the error. Thanks!

like image 656
Jayanga Kaushalya Avatar asked Oct 18 '11 12:10

Jayanga Kaushalya


1 Answers

You have specified a wrong namespace for XSL:

xmlns:xsl="http://www.w3.org/1999/xsl/Transform"

Instead, you must use:

xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

Remember that XML is case-sensitive.

like image 72
Dimitre Novatchev Avatar answered Sep 28 '22 08:09

Dimitre Novatchev