XPath中使用的比较运算符列表:
Index | Operator | Description |
---|---|---|
1) | = | 它指定等于 |
2) | != | 它指定不等于 |
3) | < | 它指定小于 |
4) | > | 它指定大于 |
5) | < = | 它指定小于或等于 |
6) | > = | 它指定大于或等于 |
employee.xml
<
?xml version = "1.0"?>
<
?xml-stylesheet type = "text/xsl" href = "http://www.srcmini.com/employee.xsl"?>
<
class>
<
employee id = "001">
<
firstname>
Abhiram<
/firstname>
<
lastname>
Kushwaha<
/lastname>
<
nickname>
Manoj<
/nickname>
<
salary>
15000<
/salary>
<
/employee>
<
employee id = "002">
<
firstname>
Akash<
/firstname>
<
lastname>
Singh<
/lastname>
<
nickname>
Bunty<
/nickname>
<
salary>
25000<
/salary>
<
/employee>
<
employee id = "003">
<
firstname>
Brijesh<
/firstname>
<
lastname>
Kaushik<
/lastname>
<
nickname>
Ballu<
/nickname>
<
salary>
20000<
/salary>
<
/employee>
<
employee id = "004">
<
firstname>
Zoya<
/firstname>
<
lastname>
Mansoori<
/lastname>
<
nickname>
Sonam<
/nickname>
<
salary>
30000<
/salary>
<
/employee>
<
/class>
员工.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>
Employee<
/h2>
<
table border = "1">
<
tr bgcolor = "pink">
<
th>
ID<
/th>
<
th>
First Name<
/th>
<
th>
Last Name<
/th>
<
th>
Nick Name<
/th>
<
th>
Salary<
/th>
<
/tr>
<
xsl:for-each select = "class/employee">
<
xsl:if test = "salary >
25000">
<
tr>
<
td>
<
xsl:value-of select = "@id"/>
<
/td>
<
td>
<
xsl:value-of select = "firstname"/>
<
/td>
<
td>
<
xsl:value-of select = "lastname"/>
<
/td>
<
td>
<
xsl:value-of select = "nickname"/>
<
/td>
<
td>
<
xsl:value-of select = "salary"/>
<
/td>
<
/tr>
<
/xsl:if>
<
/xsl:for-each>
<
/table>
<
/body>
<
/html>
<
/xsl:template>
<
/xsl:stylesheet>
【XPath比较运算符】输出
文章图片
推荐阅读
- XPath运算符
- android uboot config nor flash
- 学习安卓开发[2] - 在Activity中托管Fragment
- 手机app有了证件识别功能会怎样()
- 哪种安卓手机游戏录屏更好()
- 左手内容右手科技,讯飞阅读打造适合年轻人的有声阅读APP
- Android学习—— Android 知识梳理
- Android Studio 设置好远程库,更新时报 failed 问题
- Appium九宫格滑动解锁