简体   繁体   中英

XSLT Stylesheet not rendering

My XSLT stylesheet will not render and I'm completely stumped as to why.

Here is my XML:

    <?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet type="text/xsl" href="XSLTFile.xsl"?>

<Envelope>

  <Guid>1</Guid>
  <Guid>3</Guid>
  <Guid>2</Guid>
</Envelope>

XSLT:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:template match="/">
    <html>
      <body>
        <h2>Test</h2>
        <xsl:value-of select="Envelope/Guid"/>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>

Output when not running compatibility mode (IE 9): 1 2 3 Output when running compatibility mode:

The XML page cannot be displayed Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.


The stylesheet does not contain a document element. The stylesheet may be empty, or it may not be a well-formed XML documen...

I reproduced your issue: href="XSLTFile.xsl" is invalid address of the referenced style sheet. Correct it or put your XSL file in the same location as XML file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM