Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > where is the problem?

Reply
Thread Tools

where is the problem?

 
 
duzy
Guest
Posts: n/a
 
      03-05-2005
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"
xmlnssl="http://www.w3.org/1999/XSL/Transform">
<xslutput 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"
xmlnssi="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>


 
Reply With Quote
 
 
 
 
Joris Gillis
Guest
Posts: n/a
 
      03-05-2005
Tempore 02:43:05, die Saturday 05 March 2005 AD, hinc in foro {comp.text.xml} scripsit duzy <>:

> 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"
xmlnssl="http://www.w3.org/1999/XSL/Transform" xmlns:ws="http://www.w3schools.com">
<xslutput 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,
--
Joris Gillis (http://www.ticalc.org/cgi-bin/acct-v...i?userid=38041)
"Η αλήθεια και το λάδι πάντα βγαίνουν από πάνω"
 
Reply With Quote
 
 
 
 
Joris Gillis
Guest
Posts: n/a
 
      03-05-2005
Tempore 13:15:19, die Saturday 05 March 2005 AD, hinc in foro {comp.text.xml} scripsit duzy <>:

> 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,
--
Joris Gillis (http://www.ticalc.org/cgi-bin/acct-v...i?userid=38041)
"Η αλήθεια και το λάδι πάντα βγαίνουν από πάνω"
 
Reply With Quote
 
duzy
Guest
Posts: n/a
 
      03-05-2005

Joris Gillis wrote:

> 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.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57