2023-09-08

XSLT stylesheet won't link to XML in browser

Newbie here so sorry if this is a basic question, basically I have an XML that won't link to my XSL stylesheet. This is what is at the top of my XML document:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="TransformDocument.xsl"?>
<root>
  <listing>
    <seller_info>

The XSL stylesheet is contained within the same folder and is called TransformDocument.xsl, which looks like this

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3org1999/XSL/Transform">
    <xsl:template match="/">
    <html>
    <head></head>
    <body>
        <xsl:apply-templates select="/root/listing"/>
    </body>
        </html>
</xsl:template> 

<xsl:template match="listing">
    Testing123
</xsl:template>

</xsl:stylesheet>

I am not getting testing123 displaying anywhere when I open the XML file. I don't think it is linking because I also just put testing123 in the <body> tags and still nothing was displayed.

I have tried this in Chrome and Edge.

I tried this as well but again nothing was displayed:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3org1999/XSL/Transform">
    <xsl:template match="/">
        <html>
            <head></head>
            <body>
                Testing123
            </body>
        </html>
    </xsl:template> 

</xsl:stylesheet>


No comments:

Post a Comment