1

What am I doing wrong? It shows up as a blank page. I don't know a whole lot of xslt so I'm just testing it right now. If I can't get this to show up though then I can't really test how it works.

My XML

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="q3.xsl"?>
<expenseReport>
    <companyInfo>
        <name>John Doe</name>
        <email>JDoe@company.com</email>
        <empNum>1</empNum>
        <companyCode>10010011</companyCode>
    </companyInfo>
</expenseReport>

xslt

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
  <html>
  <body>
    <h1>Test</h1>
    <xsl:value-of select="expenseReport/companyInfo/name"/>
  </body>
  </html>
</xsl:template>
</xsl:stylesheet>

I can't even get that <h1> to show up, what's going on?

Howdy_McGee
  • 10,422
  • 29
  • 111
  • 186
  • How are you testing it? Works here if I save the files and open them directly in Firefox or IE, but in Chrome it's just a blank page. – harpo Oct 15 '11 at 00:28
  • I'm opening it up in google chrome with no luck. I can view source and see the XML but as far as the test H! or the name there's nothing. Just blank white screen. I do open the XML file right? Not the XSL? But I'll be darned, it shows up in firefox – Howdy_McGee Oct 15 '11 at 00:30
  • 1
    http://stackoverflow.com/questions/2981524/how-can-i-make-xslt-work-in-chrome/6251757#6251757 – Mads Hansen Oct 15 '11 at 00:44
  • Generally, if you're learning XSLT, trying it in the browser is not the best way of doing it. Browsers are very poor when it comes to giving feedback to the developer. Get yourself an XML IDE like oxygen. – Michael Kay Oct 15 '11 at 14:47

1 Answers1

1

Please use --allow-file-access-from-files if you are trying to view local files from Chrome. They are very strict with local file access so do not rely on this option when you deploy your site. Only use it for development! I just checked it with version 14.0.385.202 and it worked.

Other than this your .xslt is just fine!

FailedDev
  • 26,680
  • 9
  • 53
  • 73