JoeJoe
JoeJoe

Reputation: 64

Why my XML page doesn't show transformed elements?

Hi good morning, I have this xml page but doesn't show on browsers, can you please tell me why? I really try to find out why but I didn't achieve it, here are the document codes:

XML

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?xml-stylesheet type="text/xsl" href="shakes.xsl"?>
<!DOCTYPE shakes
[
<!ELEMENT shake (name,short_desc,link_desc,price)
<!ELEMENT name (#PCDATA)>
<!ELEMENT link_desc (#PCDATA)>
<!ELEMENT price (#PCDATA)>
]>

<shakes>

<shake>
<name number="1">FruitStorm</name>
<short_desc>orange,pineapple,lemon</short_desc>
<link_desc>about</link_desc>
<price>$1.80</price>
</shake>

<shake>
<name number="2">RevivalShake</name>
<short_desc>honey,apple,wildfruits</short_desc>
<link_desc>about</link_desc>
<price>$2.00</price>
</shake>

<shake number="3">
<name>ShakeStyle</name>
<short_desc>carrots,greenroot,tomatoe,lemon</short_desc>
<link_desc>about</link_desc>
<price>$1.80</price>

</shake>
</shakes>

XSL

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="shakes">
<html>
<head>
<link rel="stylesheet" type="text/css" href="cssData.css">
</head>
<body>
<xsl:apply-templates select="shakes"/>
</body>
</html>
<xsl:template>
<xsl:template match="shake">
<div class="Outer_ShakeFrame">
<span class="Text_ShakeFrame" width="80%"><xsl:value-of select="name"></span>
<span class="Text_ShakeFrame" width="20%"><xsl:value-of select="@number"></span>
<div class="Inner_ShakeFrame"></div>
<span class="Price_ShakeFrame"><xsl:value-of select="price"></span>
<marquee class="Marquee_ShakeFrame" scrollamount="4"><xsl:value-of select="short_desc"></marquee>
<a href="vide"><img src="arrow.gif" alt="About" class="Link_ShakeFrame"></a>
</div>
</xsl:template>
</xsl:stylesheet>

CSS

.Outer_ShakeFrame{
display:block;
border:1px solid black;
padding:2px;
margin:2px;
width:116px;
height:165px;
}
.Text_ShakeFrame{
text-transform:uppercase;
border-color:#000000;
padding:3px;
background-color:lightblue;
font-size:0.8em;
}
.Inner_ShakeFrame{
display:block;
border:1px solid black;
padding:5px;
margin-left:2.5px;
margin-top:7px;
width:85%;
height:85px;
}
.Link_ShakeFrame{
width:20%;
height:1.4em;
}
.Marquee_ShakeFrame{
background-color:lightblue;
width:70%;
padding:3px;
font-size:0.8em;
text-transform:uppercase;
margin-top:3px;
}
.Price_ShakeFrame{
text-align:right;
font-size:0.8em;
background-color:lightblue;
text-transform:uppercase;

}

it is supposed to show three items as this (see picture) with its information extracted from xml document with xls file. thank you in advance enter image description here

Upvotes: 0

Views: 51

Answers (1)

Furqan Aziz
Furqan Aziz

Reputation: 1104

You are having an error in your xsl file. You are not closing your <xsl:template match="shakes"> tag instead re-opening and empty template tag [missing slash / in there].

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="shakes">
        <html>
            <head>
                <link rel="stylesheet" type="text/css" href="cssData.css" />  // You are missing closing slash here 
            </head>
            <body>
                <xsl:apply-templates select="shakes"/>
            </body>
        </html>
    </xsl:template> // You are missing closing slash here 
    <xsl:template match="shake">
        <div class="Outer_ShakeFrame">
            <span class="Text_ShakeFrame" width="80%"><xsl:value-of select="name"></span>
            <span class="Text_ShakeFrame" width="20%"><xsl:value-of select="@number"></span>
            <div class="Inner_ShakeFrame"></div>
            <span class="Price_ShakeFrame"><xsl:value-of select="price"></span>
            <marquee class="Marquee_ShakeFrame" scrollamount="4"><xsl:value-of select="short_desc"></marquee>
            <a href="vide"><img src="arrow.gif" alt="About" class="Link_ShakeFrame"></a>
        </div>
    </xsl:template>
</xsl:stylesheet>

Upvotes: 0

Related Questions