>> English <<
|
česky
ZVON
>
Tutorials
>
Schematron Tutorial
Intro
/
Search
/
ZVON
>> Example 6 <<
|
Prev
|
Next
|
Contents
Description
Test, if an element has a predefined value
Schema
<
schema
xmlns="
http://www.ascc.net/xml/schematron
" >
<
pattern
name
="
Predefined values
">
<
rule
context
="
AAA
">
<
report
test
="
normalize-space(.) = 'aaa' or normalize-space(.) = 'bbb'
">O.K.</
report
>
<
assert
test
="
normalize-space(.) = 'aaa' or normalize-space(.) = 'bbb'
">The AAA value is not permitted.</
assert
>
</
rule
>
</
pattern
>
</
schema
>
Sources and outputs
Source (XML 1)
Output
<AAA>
aaa
</AAA>
Pattern:
Predefined values
/AAA
: O.K.
Source (XML 2)
Output
<AAA>
bbb
</AAA>
Pattern:
Predefined values
/AAA
: O.K.
Source (XML 3)
Output
<AAA>
ccc
</AAA>
Pattern:
Predefined values
/AAA
: The AAA value is not permitted.