GrimSage Posted March 17, 2003 Share Posted March 17, 2003 Ok I have some homework and I am totally lost on how to do it. http://www.cs.eku.edu/~kawing/csc745/prog0311.htm that is the homework. I am on the bonus I got the regular stuff done. I am not sure how to use the XLS and XLST stuff to use the XML file created to ouput html. I mean I could maunally type the xsl file but I dont think that is what is wanted. Any help would be most appreciated Link to comment Share on other sites More sharing options...
0 GrimSage Posted March 18, 2003 Author Share Posted March 18, 2003 bump Link to comment Share on other sites More sharing options...
0 azcodemonkey Posted March 18, 2003 Share Posted March 18, 2003 The site you linked to is down. I'll try to help you when it comes back up. Link to comment Share on other sites More sharing options...
0 GrimSage Posted March 18, 2003 Author Share Posted March 18, 2003 not sure when it will come back up.... they are messing with power at school durring spring break so I will try to attach the file csc545a1.htm Link to comment Share on other sites More sharing options...
0 azcodemonkey Posted March 18, 2003 Share Posted March 18, 2003 It looks to me that you are supposed to create the XSL files by hand. To transform it to html you'll need an XSLT processor like Xalan. Here is a good resource for different processors; http://www.garshol.priv.no/download/xmltoo...ols/std_ix.html. For instance, say you want to transform prog1a.xml and you're using XT. At the command line type: xt prog1a.xml prog1a.xsl prog1a.html . Now, if you need help in writing XSL, here is a very simple example of what you could do. I've taken the Suppliers table and made an XML file out of it since I don't have your XML, which is fine. I don't want to do your homework for you. :) XML file <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="suppliers.xsl"?> <mydb1> <Supplier key="S1"> ?<Sname>Smith</Sname> ?<Status>20</Status> ?<City>London</City> </Supplier> <Supplier key="S2"> ?<Sname>Jones</Sname> ?<Status>10</Status> ?<City>Paris</City> </Supplier> <Supplier key="S3"> ?<Sname>Blake</Sname> ?<Status>30</Status> ?<City>Paris</City> </Supplier> <Supplier key="S4"> ?<Sname>Clarke</Sname> ?<Status>20</Status> ?<City>London</City> </Supplier> <Supplier key="S5"> ?<Sname>Adams</Sname> ?<Status>30</Status> ?<City>Athens</City> </Supplier> </mydb[b]XSL file[/b]XSL file [code]<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"> <xsl:template match="/"> <html> <head> ?<title></title> </head> <body> ?<table cellpadding="0" cellspacing="0" border="0" width="250px"> ? <thead> ? ?<tr> ? ? <th align="left">Supplier Name</th> ? ? <th align="left">Status</th> ? ? <th align="left">City</th> ? ?</tr> ? </thead> ? <tbody> ? ?<xsl:for-each select="mydb1/Supplier"> ? ?<tr> ? ? <td> ? ? ?<xsl:value-of select="Sname"/> ? ? </td> ? ? <td align="left"><xsl:value-of select="Status"/></td> ? ? <td align="left"><xsl:value-of select="City"/></td> ? ?</tr> ? ?</xsl:for-each> ? </tbody> ?</table> </body> </html> </xsl:template> </xsl:stylesheet> All the XSL file does is iterate through the table with xsl:for-each and selects the different columns from the row and retrieves their value. A new row in the HTML table is created for each node in the XML. I'd recommend doing some research on XML/XSL at http://www.xml.org. Lot<?xml-stylesheet type="text/xsl" href="suppliers.xsl"?>t/xsl" href="suppliers.xsl"?> links the stylesheet to the XML doc. You can load it in a browser at that point and it will be transformed. That isn't what you're supposed to do, however. You are supposed to use an XSLT processor to write out the HTML. Link to comment Share on other sites More sharing options...
Question
GrimSage
Ok I have some homework and I am totally lost on how to do it.
http://www.cs.eku.edu/~kawing/csc745/prog0311.htm
that is the homework.
I am on the bonus I got the regular stuff done.
I am not sure how to use the XLS and XLST stuff to use the XML file created to ouput html. I mean I could maunally type the xsl file but I dont think that is what is wanted. Any help would be most appreciated
Link to comment
Share on other sites
4 answers to this question
Recommended Posts