【发布时间】:2012-12-18 11:45:53
【问题描述】:
我正在尝试使用 Schematron 检查属性是否存在。
<Layout>
<Pages>
<Page id="id-001" description="Database Sections">
</Page>
</Pages>
<TreeViews>
<TreeView id="id-001" description="">
</TreeView>
</TreeViews>
如果有一个“TreeView id”,它必须已经存在于一个“Page id”中
所以我尝试计算与“Treeview id”同名的“Page id´s”,它们必须 >=1:
<?xml version="1.0" encoding="UTF-8"?>
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
queryBinding="xslt2">
<sch:pattern name="Vote Count">
<sch:rule context="Layout/TreeViews/Treeview/@name">
<sch:report test="count(Layout/Pages/Page[@id=current()]) >= 1">
min. 1
</sch:report>
</sch:rule>
</sch:pattern>
</sch:schema>
我做错了什么?感谢您的帮助!
【问题讨论】:
标签: attributes count schematron