Xml-xsl

Discussion in 'Software' started by StratCat, Nov 19, 2003.

  1. StratCat

    StratCat Private E-2

    I need something Impressive in XSL for a XML file that I have to do for a presentation for work

    Here is what I have so far.

    the xml file
    the xsl file

    take a look at the xsl file any ideas on something I could do with it using xsl that would be cool?

    here is the XSL


    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/">
    <html>
    <body>
    <h2>MY CD's</h2>
    <table border="1">
    <tr bgcolor="#c0c0c0">
    <th align="center">Title</th>
    <th align="center">Artist</th>
    <th align="left">Country</th>
    <th align="left">Company</th>
    <th align="left">Price</th>
    <th align="left">Year</th>
    </tr>
    <xsl:for-each select="catalog/cd">
    <xsl:sort select="artist"/>
    <tr>
    <td><xsl:value-of select="title"/></td>
    <td><xsl:value-of select="artist"/></td>
    <td><xsl:value-of select="country"/></td>
    <td><xsl:value-of select="company"/></td>
    <td><xsl:value-of select="year"/></td>
    <xsl:choose>
    <xsl:when test="price &gt; 15">
    <td bgcolor="#FFFF00">
    <xsl:value-of select="price"/></td>
    </xsl:when>
    <xsl:eek:therwise>
    <td><xsl:value-of select="price"/></td>
    </xsl:eek:therwise>
    </xsl:choose>

    </tr>
    </xsl:for-each>
    </table>
    </body>
    </html>
    </xsl:template></xsl:stylesheet>

    HERE IS THE XML

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <?xml-stylesheet type="text/xsl" href="MyCds.xsl"?>
    <catalog>
    <cd id="1">
    <title>Crash Into Me</title>
    <artist>Dave Matthews</artist>
    <country>USA</country>
    <company>Columbia</company>
    <price>15.00</price>
    <year>1993</year>
    </cd>
    <cd id="2">
    <title>Reload</title>
    <artist>Metallica</artist>
    <country>USA</country>
    <company>Virgin</company>
    <price>17.00</price>
    <year>2000</year>
    </cd>
    <cd id="3">
    <title>load</title>
    <artist>Metallica</artist>
    <country>USA</country>
    <company>Virgin</company>
    <price>16.50</price>
    <year>1998</year>
    </cd>
    <cd id="4">
    <title>Dangerzone</title>
    <artist>Kenny Loggins</artist>
    <country>Japan</country>
    <company>RCA</company>
    <price>13.00</price>
    <year>1981</year>
    </cd>
    <cd id="5">
    <title>Tesla Live</title>
    <artist>Tesla</artist>
    <country>Canada</country>
    <company>Virgin</company>
    <price>17.00</price>
    <year>1987</year>
    </cd>
    <cd id="6">
    <title>Journey's Greatest Hits</title>
    <artist>Journey</artist>
    <country>USA</country>
    <company>Virgin</company>
    <price>16.00</price>
    <year>1988</year>
    </cd>
    <cd id="7">
    <title>Poison</title>
    <artist>Poison</artist>
    <country>USA</country>
    <company>RCA</company>
    <price>14.00</price>
    <year>1983</year>
    </cd>
    <cd id="8">
    <title>Firehouse</title>
    <artist>Freedom</artist>
    <country>USA</country>
    <company>Virgin</company>
    <price>11.50</price>
    <year>1984</year>
    </cd>
    <cd id="9">
    <title>Back In Black</title>
    <artist>AC/DC</artist>
    <country>USA</country>
    <company>RCA</company>
    <price>18.00</price>
    <year>1981</year>
    </cd>
    <cd id="10">
    <title>Michael Bolton's Greatest</title>
    <artist>Michael Bolton</artist>
    <country>Canada</country>
    <company>RCA</company>
    <price>16.00</price>
    <year>1995</year>
    </cd>
    <cd id="11">
    <title>Highway</title>
    <artist>AC/DC</artist>
    <country>USA</country>
    <company>RCA</company>
    <price>13.00</price>
    <year>1985</year>
    </cd>
    </catalog>
     
  2. Kodo

    Kodo SNATCHSQUATCH

    what would you define as "cool".
    I've not mess around much with XSL though..
     
  3. StratCat

    StratCat Private E-2

    Anything advanced that would impress a boss of a position I want :)
     
  4. StratCat

    StratCat Private E-2

    Ok well since I did not have time to wade through all of the replies that I received I decided to do an XSL statement using the if, then else statements and choose when other wise statements.....
     
  5. Kodo

    Kodo SNATCHSQUATCH

    sorry man, it's been a very busy past few days with a sick baby.
     
  6. StratCat

    StratCat Private E-2

    Nah, man its ok I completely understand I meant to have a :D on that last reply...my bad.....I did not mean it like it sounded....

    :D:D:D:D
     
  7. unclematty

    unclematty Private First Class

    so when are we gonna see what you finally came up with?
     
  8. PAR

    PAR Private E-2

    This is the only post I can find that deals with xsl. I'm trying to learn it using Dreamweaver 8. I have created a page that works great when I hit F12 in Dreamweaver. But when I upload it to the site, it doesn't work. See: http://www.paross.com/index.xsl

    What's wrong with it?

    On a similar note, I was hoping to use it as my defaul page (index.htm), but it doesn't render with the .htm extension and won't default with the .xsl extension. So, how do I get xsl to work on the default page?

    Phil
     
  9. Kodo

    Kodo SNATCHSQUATCH

    I really haven't tried out xsl yet still.. but there are loads of tutorials on the net..
    have you tried the following?
    http://www.w3schools.com/xsl/
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds