I am seeking a solution to emphasize rows containing the "year" element with a value exceeding "2000" in XML and XSLT.
Here is the code snippet:
XML
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="harrypotterbooks.xsl"?>
<!DOCTYPE catalog [
<!ELEMENT catalog (book)>
<!ELEMENT book (title,author,country,publisher,price,year)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT author (#PCDATA)>
<!ELEMENT country (#PCDATA)>
<!ELEMENT publisher (#PCDATA)>
<!ELEMENT price (#PCDATA)>
<!ELEMENT year (#PCDATA)>
]>
<catalog>
<book>
<title>Harry Potter and the Philosophers Stone</title>
<author>J.K Rowling</author>
<country>United Kingdom</country>
<publisher>Bloomsbury</publisher>
<price>$11.99</price>
<year>26/06/1997</year>
</book>
<book>
<title>Harry Potter and the Chamber of Secrets</title>
<author>J.K Rowling</author>
<country>United Kingdom</country>
<publisher>Bloomsbury</publisher>
<price>$13.99</price>
<year>02/07/1998</year>
</book>
<book>
<title>Harry Potter and the Prisoner of Azkaban</title>
<author>J.K Rowling</author>
<country>United Kingdom</country>
<publisher>Bloomsbury</publisher>
<price>$12.99</price>
<year>08/07/1999</year>
</book>
<book>
<title>Harry Potter and the Goblet of Fire</title>
<author>J.K Rowling</author>
<country>United Kingdom</country>
<publisher>Bloomsbury</publisher>
<price>$16.99</price>
<year>08/07/2000</year>
</book>
<book>
<title>Harry Potter and the Order of the Phoenix</title>
<author>J.K Rowling</author>
<country>United Kingdom</country>
<publisher>Bloomsbury</publisher>
<price>$17.99</price>
<year>21/06/2003</year>
</book>
<book>
<title>Harry Potter and the Half Blood Prince</title>
<author>J.K Rowling</author>
<country>United Kingdom</country>
<publisher>Bloomsbury</publisher>
<price>$19.99</price>
<year>16/07/2005</year>
</book>
<book>
<title>Harry Potter and the Deathly Hallows</title>
<author>J.K Rowling</author>
<country>United Kingdom</country>
<publisher>Bloomsbury</publisher>
<price>$25.99</price>
<year>21/07/2007</year>
</book>
</catalog>
and this XSL
<?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 Book Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Title</th>
<th>Author</th>
<th>Country</th>
<th>Publisher</th>
<th>Price</th>
<th>Year of Release</th>
</tr>
<xsl:for-each select="catalog/book">
<tr xsl:if test="substring-after(year,'/') > 2000">
<td><xsl:value-of select="title"/></td>
<td><xsl:value-of select="author"/></td>
<td><xsl:value-of select="country"/></td>
<td><xsl:value-of select="publisher"/></td>
<td><xsl:value-of select="price"/></td>
<td><xsl:value-of select="year"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
What would be the optimal approach to highlight any row where the "year" value is greater than "2000"?
Thank you kindly