xsl里关于choose的问题
有一个如下的XMl的代码,要写一个xsl的代码来将XMl转换成表格显示
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="1111.xsl"?><INVENTORY> <BOOK> <TITLE>XML基础教程</TITLE> <AUTHOR>李白</AUTHOR> <BINDING>清华出版社</BINDING> <PAGES>462</PAGES> <PRICE>25元</PRICE> </BOOK> <BOOK> <TITLE>java高级编程</TITLE> <AUTHOR>李清照</AUTHOR> <BINDING>北大出版社</BINDING> <PAGES>98</PAGES> <PRICE>29.5元</PRICE> </BOOK> <BOOK> <TITLE>jsp网站开发</TITLE> <AUTHOR>庄子</AUTHOR> <BINDING>古籍出版社</BINDING> <PAGES>473</PAGES> <PRICE>49.5元</PRICE> </BOOK> <BOOK> <TITLE>计算机基础</TITLE> <AUTHOR>赵本山</AUTHOR> <BINDING>辽宁出版社</BINDING> <PAGES>724</PAGES> <PRICE>99.5元</PRICE> </BOOK> <BOOK> <TITLE>asp动态网站开发</TITLE> <AUTHOR>小白龙</AUTHOR> <BINDING>西游出版社</BINDING> <PAGES>256</PAGES> <PRICE>49.5元</PRICE> </BOOK> <BOOK> <TITLE>c语言精要</TITLE> <AUTHOR>白晓声</AUTHOR> <BINDING>现代出版社</BINDING> <PAGES>253</PAGES> <PRICE>42.5元</PRICE> </BOOK> <BOOK> <TITLE>网络安全</TITLE> <AUTHOR>黑客</AUTHOR> <BINDING>河南出版社</BINDING> <PAGES>384</PAGES> <PRICE>33.5元</PRICE> </BOOK></INVENTORY>
<?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> <style> .title{font-size:15pt; font-weight:bold; color:blue } .name {color:red} </style> </head> <body> <P class="title">图书信息</P> <table border="1"> <thead> <td><b>标 题</b></td> <td><b>作 者</b></td> <td><b>出 版 社</b></td> <td><b>页 数</b></td> <td><b>价 格</b></td> </thead> <xsl:for-each select="INVENTORY/BOOK"> <tr> <td> <xsl:value-of select="TITLE"/> </td> <td> <xsl:value-of select="AUTHOR"/> </td> <td> <xsl:value-of select="BINDING"/> </td> <td> <xsl:value-of select="PAGES"/> </td> <td> <xsl:value-of select="PRICE"/> </td> </rar
<?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> <head> <title>图书信息</title> <style> .title{font-size:15pt; font-weight:bold; color:blue } .name {color:red} </style> </head> <body> <P class="title">图书信息</P> <table border="1"> <thead> <td><b>标 题</b></td> <td><b>作 者</b></td> <td><b>出 版 社</b></td> <td><b>页 数</b></td> <td><b>价 格</b></td> </thead> <xsl:for-each select="INVENTORY/BOOK"> <tr> <xsl:choose> <xsl:when test="PAGES>500"> <xsl:attribute name="bgcolor">red</xsl:attribute> </xsl:when> <xsl:when test="PAGES<100"> <xsl:attribute name="bgcolor">blue</xsl:attribute> </xsl:when> </xsl:choose> <td> <xsl:value-of select="TITLE"/> </td> <td> <xsl:value-of select="AUTHOR"/> </td> <td> <xsl:value-of select="BINDING"/> </td> <td> <xsl:value-of select="PAGES"/> </td> <td> <xsl:value-of select="PRICE"/> </td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template></xsl:stylesheet>
[解决办法]
小于号 换成 <
[解决办法]
虽然大于号没有错,但是你最好也替换了>