<%@ page language="java" contentType="text/html; charset=gb2312"
pageEncoding="gb2312"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x"%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<x:parse var="simple">
<customers>
<customer id="1" status="11">
<name>111</name>
</customer>
<customer id="1" status="113">
<name>1113</name>
</customer>
<customer id="2" status="22">
<name>222</name>
</customer>
<customer id="3" status="33">
<name>333</name>
</customer>
</customers>
</x:parse>
条件为id和status:
<x:forEach select="$simple//customer[@id='1'][@status='113']">
<x:out select="name"/>
</x:forEach>
<br>
条件为id:
<x:forEach select="$simple//customer[@id='1']">
<x:out select="name"/>
</x:forEach>
<br>
单独打印id=1并且ststus=113的数据
<x:out select="$simple//customer[@id='1'][@status='113']/name"/>
</body>
</html>