where is the problem?

D

duzy

Hi!

I do not understand why it generates only tables with colors according to
css, and do not display any text or image.


plik catalog.xsl
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:eek:utput method="html" />
<xsl:template match="/">
<html>
<head>
<title>catalog.xsl</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table align="center" class="episodb">
<tr>
<td>
<img>
<xsl:attribute name="src">
img/ <xsl:value-of select="/root/titleimg" />
</xsl:attribute>
</img>
</td>
</tr>
</table>
<br />
<xsl:for-each select="/root/brief/wers">
<table align="center" width="800" class="episodb">
<tr>
<td>
<xsl:value-of select="." />
</td>
</tr>
</table>
<br /> <br />
</xsl:for-each>
<table align="center" class="episodb">
<tr>
<td>
<img width="400">
<xsl:attribute name="src">
img/<xsl:value-of select="/root/foto/@name" />.gif
</xsl:attribute>
</img>
</td>
</tr>
</table>
<br /><br />
<table align="center" class="episodb">
<tr>
<td>
<xsl:value-of select="/root/foto" />
</td>
</tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

plik xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="catalog.xsl"?>
<root xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3schools.com catalog.xsd">

<titleimg>title.jpg</titleimg>
<brief>
<wers>
Two University of Colorado film students named Matt Stone and
Trey Parker made a short cartoon called "Jesus vs Frosty" (also known as The
ORIGINAL Spirit of Christmas) in which some kids make a snowman that comes
to life and starts killing everyone. Eventually Jesus comes along and chops
off Frosty's head by throwing his halo at him.
</wers><wers>
Executives from the American Fox Network somehow caught sight of
this cartoon and commissioned Matt and Trey to make another short to be sent
out to celebrities as a Christmas card, this was the called "The Spirit of
Christmas" The film was an instant hit. Everyone wanted to see it. Rumor has
it that George Clooney made 300 copies of the video to give to his friends.
</wers><wers>
Eventually the video made it to the Internet where everyone got
to see it. It was then inevitable that the cartoon would be made into a TV
Series, and Comedy Central who had previously shown King of the Hill
commissioned Matt and Trey to produce a series. The rest is history....
</wers>
</brief>
<foto name="busstop">Somethink about main haracters (from the left in
foto)</foto>
</root>
 
J

Joris Gillis

Tempore 02:43:05 said:
I do not understand why it generates only tables with colors according to
css, and do not display any text or image.
Hi,

All elements in your source XML document have a namsepace other than the default one. So in order to access these elements properly, you have to define the namespace also in your XSL. You're free to choose a prefix.

example:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ws="http://www.w3schools.com">
<xsl:eek:utput method="html" />
<xsl:template match="/">
<html>
<head>
<title>catalog.xsl</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table align="center" class="episodb">
<tr>
<td>
<img>
<xsl:attribute name="src">
img/ <xsl:value-of select="/ws:root/ws:titleimg" />
</xsl:attribute>
</img>
</td>
</tr>
</table>
<br />
<xsl:for-each select="/ws:root/ws:brief/ws:wers">
<table align="center" width="800" class="episodb">
<tr>
<td>
<xsl:value-of select="." />
</td>
</tr>
</table>
<br /> <br />
</xsl:for-each>
<table align="center" class="episodb">
<tr>
<td>
<img width="400">
<xsl:attribute name="src">
img/<xsl:value-of select="/ws:root/ws:foto/@name" />.gif
</xsl:attribute>
</img>
</td>
</tr>
</table>
<br /><br />
<table align="center" class="episodb">
<tr>
<td>
<xsl:value-of select="/ws:root/ws:foto" />
</td>
</tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

btw, why are you using tables to display a flow of paragraphs? That's absurd...


regards,
 
J

Joris Gillis

Tempore 13:15:19 said:
It's only way I know to have another color of background under the
paragraphs (in tables), and another between paragraphs.
Css is your friend;-)

regards,
 
D

duzy

Joris said:
btw, why are you using tables to display a flow of paragraphs? That's
absurd...

It's only way I know to have another color of background under the
paragraphs (in tables), and another between paragraphs.

Thanks. You helped me a lot.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,149
Members
46,695
Latest member
StanleyDri

Latest Threads

Top