1 / 6

CS144 Discussion - Saxon

CS144 Discussion - Saxon. Chu-Cheng Hsieh. Example: CS144.xml. <?xml version="1.0"?> <CS144> <TA>Chu-Cheng Hsieh</TA> <Student> <Name>Eric</Name> <Score>82</Score> </Student> <Student> <Name>Jay</Name> <Score>78</Score> </Student> <Student> <Name>Amy</Name>

sari
Download Presentation

CS144 Discussion - Saxon

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS144 Discussion - Saxon Chu-Cheng Hsieh

  2. Example: CS144.xml <?xml version="1.0"?> <CS144> <TA>Chu-Cheng Hsieh</TA> <Student> <Name>Eric</Name> <Score>82</Score> </Student> <Student> <Name>Jay</Name> <Score>78</Score> </Student> <Student> <Name>Amy</Name> <Score>69</Score> </Student> <CS144>

  3. Example: ToHtml1.xslt <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform” version="2.0" > <xsl:template match="/"> <html> <head> <title>Class information TA by <xsl:value-of select="/CS144/TA" /> </title> </head> <body> <h3>The TA of CS144 is <xsl:value-of select="/CS144/TA" /> .</h3> <br /> <table border="1"> <th> <td>Score</td> </th> <xsl:apply-templates select="/CS144/Student" /> </table> <br /> <h4>We have <xsl:value-of select="count(/CS144/Student)" /> students in total.</h4> </body> </html> </xsl:template> <xsl:template match="Student"> <tr> <td> <xsl:value-of select="Name" /> </td> <td> <xsl:value-of select="Score" /> </td> </tr> </xsl:template> </xsl:stylesheet>

  4. Stud1.html <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Class information TA by Chu-Cheng Hsieh</title> </head> <body> <h3>The TA of CS144 is Chu-Cheng Hsieh .</h3><br><table border="1"> <th> <td>Score</td> </th> <tr> <td>Eric</td> <td>82</td> </tr> <tr> <td>Jay</td> <td>78</td> </tr> <tr> <td>Amy</td> <td>69</td> </tr> </table> <br><h4>We have 3 students in total.</h4> </body> </html>

  5. ToHTML2.xslt <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform” version="2.0" > <xsl:template match="/"> <html> <head> <title>Class 144 is TA by <xsl:value-of select="/CS144/TA" /> </title> </head> <body> <h3>The TA of CS144 is <xsl:value-of select="/CS144/TA" /> . His email is <xsl:value-of select="/CS144/TA/@email" /> . </h3> <br /> <ol> <xsl:apply-templates select="/CS144/Student" /> </ol> <br/> <h4>We have <xsl:value-of select="count(/CS144/Student)" /> students in total.</h4> </body> </html> </xsl:template> <xsl:template match="Student"> <li> <ul> <li> Name: <xsl:value-of select="Name" /> </li> <li> Score:<xsl:value-of select="Score" /> </li> </ul> </li> </xsl:template> </xsl:stylesheet>

  6. Stud2.html <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Class 144 is TA by Chu-Cheng Hsieh</title> </head> <body> <h3>The TA of CS144 is Chu-Cheng Hsieh . His email is cchucla@gmail.com . </h3><br><ol> <li> <ul> <li> Name: Eric</li> <li> Score:82</li> </ul> </li> <li> <ul> <li> Name: Jay</li> <li> Score:78</li> </ul> </li> <li> <ul> <li> Name: Amy</li> <li> Score:69</li> </ul> </li> </ol><br><h4>We have 3 students in total.</h4> </body> </html>

More Related