>> English <<
|
česky
ZVON
>
Tutorials
>
Schematron Tutorial
Intro
/
Search
/
ZVON
>> Example 15 <<
|
Prev
|
Next
|
Contents
Description
If an element contains an attribute , the attribute name must be id.
Schema
<
schema
xmlns="
http://www.ascc.net/xml/schematron
" >
<
pattern
name
="
id is the only permited attribute name
">
<
rule
context
="
*
">
<
report
test
="
@*[not(name()='id')]
">Atrribute
<
name
path
="
@*[not(name()='id')]
"/> is forbidden in element
<
name
/>
</
report
>
</
rule
>
</
pattern
>
</
schema
>
Sources and outputs
Source (XML 1)
Output
<AAA name="aaa">
<BBB id="bbb"/>
<CCC color="ccc"/>
</AAA>
Pattern:
id is the only permited attribute name
/AAA
: Atrribute name is forbidden in element AAA
/AAA/CCC
: Atrribute color is forbidden in element CCC