0

I'm new to XML i have made an XML file and an XSL file. After linking the XSL file to the XML file, the output of the XML in the browser goes blank. I could not find the error.

This is my XML:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="cupcake.xsl"?>
<cupcakes>

    <item>
        <name>Luscious Vanilla</name>
        <flavour>Vanilla</flavour>
        <colour>Brown</colour>
        <energy> 100 cj </energy>
    </item>

    <item>
        <name>Chocolate Hazelnut</name>
        <flavour>chocolaty</flavour>
        <colour>coffe</colour>
        <energy> 100 cj </energy>
        <cost> $10 </cost>
    </item>

    <item>
        <name>Risch Red Velvet</name>
        <flavour>red velvet</flavour>
        <colour>red</colour>
        <energy> 100 cj </energy>
        <cost> $10 </cost>
    </item>

    <item>
        <name>Classic straberry</name>
        <flavour>straberry</flavour>
        <colour>pink</colour>
        <energy> 100 cj </energy>
        <cost> $10 </cost>
    </item>

    <item>
        <name>Lemon Drop</name>
        <flavour>lemon</flavour>
        <colour>yellow</colour>
        <energy> 100 cj </energy>
        <cost> $10 </cost>
    </item>

</cupcakes>

And this is my XSL:

<?xml version="1.0" encoding="UTF-8"?>
<html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<body style="font-family:Arial;font-size:12pt;background-color:#EEEEEE">
<xsl:for-each select="cupcakes/item">
<div style="background-color:teal;color:white;padding:4px">
<span style="font-weight:bold"><xsl:value-of select="name"/> - </span>
<xsl:value-of select="price"/>
</div>
<div style="margin-left:20px;margin-bottom:1em;font-size:10pt">
<p>
<xsl:value-of select="cost"/>
</p>
</div>
</xsl:for-each>
</body>
</html>
Robby Cornelissen
  • 72,308
  • 17
  • 104
  • 121
user3501409
  • 43
  • 1
  • 6

0 Answers0