I have the following XML file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="table_classname.xsl"?> <root> <classinfo> <classname>Rhetoric 10</classname> <classlink>http://webcast.berkeley.edu/course_details.php? seriesid=1906978535</classlink> <classrating>"A"</classrating> <university>"UC Berkeley"</university> </classinfo> <classinfo> <classname>"Physics 10"</classname> <classlink>http://webcast.berkeley.edu/course_details.php? seriesid=1906978535</classlink> <classrating>"A+"</classrating> <university>"UC Berkeley+"</university> </classinfo> </root>
And the following XSLT file:
<?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">
<tr bgcolor="#9acd32">
<th align="left">Class</th>
<th align="left">University</th>
<th align="left">Rating</th>
</tr>
<xsl:for-each select="root/classinfo">
<xsl:sort select="classname"/>
<tr>
<td>
<a><a href="<xsl:value-of select="classlink"/>"><xsl:value-of select="classname"/></a> </td> <td><xsl:value-of select="university"/></td> <td><xsl:value-of select="classrating"/></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet>
I'm trying to get the href link section to pull the classlink attribute out and the classname attribute out and render it as an HTTP link. This is throwing an error stating I cant have < in an attribute. Anyone know how I can get the link to render properly?
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="table_classname.xsl"?> <root> <classinfo> <classname>Rhetoric 10</classname> <classlink>http://webcast.berkeley.edu/course_details.php? seriesid=1906978535</classlink> <classrating>"A"</classrating> <university>"UC Berkeley"</university> </classinfo> <classinfo> <classname>"Physics 10"</classname> <classlink>http://webcast.berkeley.edu/course_details.php? seriesid=1906978535</classlink> <classrating>"A+"</classrating> <university>"UC Berkeley+"</university> </classinfo> </root>
And the following XSLT file:
<?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">
<tr bgcolor="#9acd32">
<th align="left">Class</th>
<th align="left">University</th>
<th align="left">Rating</th>
</tr>
<xsl:for-each select="root/classinfo">
<xsl:sort select="classname"/>
<tr>
<td>
<a><a href="<xsl:value-of select="classlink"/>"><xsl:value-of select="classname"/></a> </td> <td><xsl:value-of select="university"/></td> <td><xsl:value-of select="classrating"/></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet>
I'm trying to get the href link section to pull the classlink attribute out and the classname attribute out and render it as an HTTP link. This is throwing an error stating I cant have < in an attribute. Anyone know how I can get the link to render properly?