如何在 products.xsl 正文中编写 xsl,以获取数量 > 10 的产品名称和状况
产品.xml:
<?xml version="1.0" encoding="iso-8859-1"?>
<products>
<product>
<name>soaps</name>
<quantity>10</quantity>
<condition>ready</condition>
</product>
<product>
<name>soaps</name>
<quantity>15</quantity>
<condition>ready</condition>
</product>
<product>
<name>soaps</name>
<quantity>20</quantity>
<condition>ready</condition>
</product>
</products>
产品.xsl
<?xml version="1.0"?><!-- DWXMLSource="products.xml" -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="/">
<HTML>
<HEAD>
<TITLE> products</TITLE>
</HEAD>
<BODY>
products quantity greater than 10 : <BR/>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>
这应该可以解决问题:
<xsl:for-each select="/products/product">
<xsl:if test="quantity > 10">
<xsl:value-of select="name" />: <xsl:value-of select="condition" /> <br/>
</xsl:if>
</xsl:for-each>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)