where is the problem?

Discussion in 'XML' started by duzy, Mar 5, 2005.

  1. duzy

    duzy Guest

    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>
    duzy, Mar 5, 2005
    #1
    1. Advertising

  2. duzy

    Joris Gillis Guest

    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"
    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,
    --
    Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041)
    "Η αλήθεια και το λάδι πάντα βγαίνουν από πάνω"
    Joris Gillis, Mar 5, 2005
    #2
    1. Advertising

  3. duzy

    Joris Gillis Guest

    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-view.cgi?userid=38041)
    "Η αλήθεια και το λάδι πάντα βγαίνουν από πάνω"
    Joris Gillis, Mar 5, 2005
    #3
  4. duzy

    duzy Guest

    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.
    duzy, Mar 5, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andreas Suurkuusk
    Replies:
    0
    Views:
    3,942
    Andreas Suurkuusk
    Jul 27, 2003
  2. Ted Miller
    Replies:
    0
    Views:
    5,133
    Ted Miller
    Sep 13, 2003
  3. Merek
    Replies:
    0
    Views:
    1,937
    Merek
    Dec 3, 2003
  4. Scott Meddows
    Replies:
    1
    Views:
    375
    John Saunders
    Jun 8, 2004
  5. Mike

    Problem problem problem :( Need Help

    Mike, May 7, 2004, in forum: ASP General
    Replies:
    2
    Views:
    521
    Bullschmidt
    May 11, 2004
Loading...

Share This Page