<?xml version="1.0" encoding="GB2312"?><?xml-stylesheet type="text/xsl" href="p1441.xsl"?> <Orders> <Order orderID="A001" orderDate="2009-1-20"> <name>玩具</name> <number>10</number> <city>北京</city> <zip>100000</zip> </Order> <Order orderID="A002" orderDate="2009-3-20"> <name>文具</name> <number>5</number> <city>青岛</city> <zip>266000</zip> </Order> </Orders>
<?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> </head> <body> <h2 align="center">订单</h2> <table border="1" cellpadding="0" align="center"> <tr> <th>名称</th> <th>数量</th> <th>城市</th> <th>邮编</th> </tr> <xsl:for-each select="Orders/Order"> <xsl:if test="//Order[@orderID='A002']"> <tr> <td> <xsl:value-of select="name"/> </td> <td> <xsl:value-of select="number"/> </td> <td> <xsl:value-of select="city"/> </td> <td> <xsl:value-of select="zip"/> </td> </tr> </xsl:if> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet>
以上为P143 题1 效果为
<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="p1453.xsl"?> <PRODUCTDATA> _<PRODUCT PRODID="P001" CATEGORY="Toy"> _ _<PRODUCTNAME>Mini Bus</PRODUCTNAME> _ _<DESCRIPTION>This is a toy for children aged 4 and above</DESCRIPTION> <PRICE>75</PRICE> <QUANTITY>54</QUANTITY> _</PRODUCT> _<PRODUCT PRODID="P002" CATEGORY="Toy"> _ <PRODUCTNAME>Barbie Doll</PRODUCTNAME> _ <DESCRIPTION>This is a toy for children in the age group of 5-10</DESCRIPTION> <PRICE>20</PRICE> <QUANTITY>200</QUANTITY> _</PRODUCT> </PRODUCTDATA>
<?xml version="1.0" encoding="gb2312"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:for-each select="PRODUCTDATA/PRODUCT"> <xsl:if test="PRODUCTNAME"> <font color="red"> 产品名: <xsl:value-of select="PRODUCTNAME"/> <BR/> <font color="green"> 描述 <xsl:value-of select="DESCRIPTION"/> </font> <BR/> <font color="green"> 价格: <xsl:value-of select="PRICE"/> </font> <BR/> <font color="green"> 现有量: <xsl:value-of select="QUANTITY"/> </font> <BR/> <HR/> </font> </xsl:if> </xsl:for-each> </xsl:template> </xsl:stylesheet>
以上为P145 题2 效果为
抄袭无益 Anr-C 2016.10.16
本站由以下主机服务商提供服务支持:
0条评论