Hi can someone help me transfer this xml to xsl please? Not sure how to do it. I
ID: 3717961 • Letter: H
Question
Hi can someone help me transfer this xml to xsl please? Not sure how to do it. It will be greatly appreciated. Thank you in advance. Also how do you get the information in the table.
<?xml version="1.0" encoding="UTF-8"?>
<roster>
<student class="Financing">
<SN>2005133110</SN>
<name>Thomas Luger</name>
<sex>male</sex>
<birthday>1986.10.21</birthday>
<score>605</score>
</student>
<student class="Financing">
<SN>2005133115</SN>
<name>Alice Schutern</name>
<sex>female</sex>
<birthday>1985.8.25</birthday>
<score>596</score>
</student>
<student class="International Financing">
<SN>2005131136</SN>
<name>Helena Wieser</name>
<sex>female</sex>
<birthday>1986.5.28</birthday>
<score>611</score>
</student>
<student class="Insurance">
<SN>2005132012</SN>
<name>Ingrid Harth</name>
<sex>female</sex>
<birthday>1986.6.19</birthday>
<score>602</score>
</student>
<student class="Financing">
<SN>2005133108</SN>
<name>Judi Stollberg</name>
<sex>female</sex>
<birthday>1987.3.15</birthday>
<score>581</score>
</student>
</roster>
Create a similar table to display the Financing student information.
3: Create a similar table to display the female student information with the rank of score.
4: Create a different format to display the student information as followings:
(2005133110)
Thomas Luger
male
1986.10.21
…
(2005133108)
Judi Stollberg
female
1987.3.15
5: Display student information in a similar table with score more than 600.
6: Display student information in a similar table with different classes using different background colors.
7: Display student information in a similar table with first rank on sex and then on score (the same sex is ranked based on score)
Explanation / Answer
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Title</th>
<th>Artist</th>
</tr>
<xsl:for-each select="catalog/cd">
<tr>
<td><xsl:value-of select="title"/></td>
<td><xsl:value-of select="artist"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
2.
<?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>
<table border="1">
<xsl:for-each select="roster/student">
<xsl:sort select="score" order="descending"/>
<xsl:if test="sex='female'">
<tr>
<xsl:value-of select="SN" /><br/>
<xsl:value-of select="name" /><br/>
<xsl:value-of select="sex" /><br/>
<xsl:value-of select="birthday" /><br/>
<xsl:value-of select="score" /><br/><br/>
</tr>
</xsl:if>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
3. <?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>
<table border="1">
<xsl:for-each select="roster/student">
<xsl:if test="score>600">
<tr>
<xsl:value-of select="SN" /><br/>
<xsl:value-of select="name" /><br/>
<xsl:value-of select="sex" /><br/>
<xsl:value-of select="birthday" /><br/>
<xsl:value-of select="score" /><br/><br/>
</tr>
</xsl:if>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
4. <?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>
<table border="1">
<xsl:for-each select="roster/student">
<tr>
<xsl:value-of select="SN" /><br/>
<xsl:value-of select="name" /><br/>
<xsl:value-of select="sex" /><br/>
<xsl:value-of select="birthday" /><br/>
<xsl:value-of select="score" /><br/><br/>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Please thumbs up if you like the answe. As per chegg policy only 4 sub questions can be answered
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.