MrD*_*MrD 1 xml xpath xquery schematron
假设我有一个XML文档定义:
<people>
<person>
<city>London</city>
</person>
<person>
<city>Paris</city>
</person>
</people>
Run Code Online (Sandbox Code Playgroud)
我想要一个检查每个人住在伦敦的图示器.
我试过了:
<sch:rule context="people">
<sch:assert test="person/city = 'London'">Everybody must live in London!</sch:assert>
</sch:rule>
Run Code Online (Sandbox Code Playgroud)
但是,只要有一个人居住在伦敦,这种情况就会恢复正常.有没有办法告诉schematron将测试应用于匹配XPathcondition人/城市的每个元素?
怎么样"没有人可以住在伦敦以外":
<sch:rule context="people">
<sch:assert test="not(person[city != 'London'])">Everybody must live in London!</sch:assert>
</sch:rule>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
802 次 |
| 最近记录: |