两个值之间的 XSLT Count()
XSLT Count() between two values
我正在尝试获取 100 到 199(均包含在内)范围内的属性计数,但我无法合并两个结果。请帮帮我
<?xml version="1.0" encoding="UTF-8"?>
<catalog>
<cd>
<title code="120">Empire Burlesque</title>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<price>10.90</price>
<year>1985</year>
</cd>
<cd>
<title code="200">Hide your heart</title>
<artist>Bonnie Tyler</artist>
<country>UK</country>
<company>CBS Records</company>
<price>9.90</price>
<year>1988</year>
</cd>
<cd>
<title code="100">Greatest Hits</title>
<artist>Dolly Parton</artist>
<country>USA</country>
<company>RCA</company>
<price>19.90</price>
<year>1982</year>
</cd>
</catalog>
以上 XML 的 XSLT 是
<?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>
<xsl:value-of select="count(//cd/title[@code >= 100 and 199 <= @code])"/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
请帮我解决这个问题
两项测试只需使用 >
:
count(//cd/title[@code >= 100 and 199 >= @code])
>
不应该 有 转义为 >
。哪个都好。
我正在尝试获取 100 到 199(均包含在内)范围内的属性计数,但我无法合并两个结果。请帮帮我
<?xml version="1.0" encoding="UTF-8"?>
<catalog>
<cd>
<title code="120">Empire Burlesque</title>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<price>10.90</price>
<year>1985</year>
</cd>
<cd>
<title code="200">Hide your heart</title>
<artist>Bonnie Tyler</artist>
<country>UK</country>
<company>CBS Records</company>
<price>9.90</price>
<year>1988</year>
</cd>
<cd>
<title code="100">Greatest Hits</title>
<artist>Dolly Parton</artist>
<country>USA</country>
<company>RCA</company>
<price>19.90</price>
<year>1982</year>
</cd>
</catalog>
以上 XML 的 XSLT 是
<?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>
<xsl:value-of select="count(//cd/title[@code >= 100 and 199 <= @code])"/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
请帮我解决这个问题
两项测试只需使用 >
:
count(//cd/title[@code >= 100 and 199 >= @code])
>
不应该 有 转义为 >
。哪个都好。