>> English <<
|
česky
ZVON
>
Tutorials
>
Schematron Tutorial
Intro
/
Search
/
ZVON
>> Example 4 <<
|
Prev
|
Next
|
Contents
Description
Test, if the root element has the specified name
Schema
<
schema
xmlns="
http://www.ascc.net/xml/schematron
" >
<
pattern
name
="
Root test
">
<
rule
context
="
/*
">
<
assert
test
="
name()='AAA'
">Root element is
<
name
/>, not AAA
</
assert
>
<
report
test
="
name()='AAA'
">Root element is AAA</
report
>
</
rule
>
</
pattern
>
</
schema
>
Sources and outputs
Source (XML 1)
Output
<AAA>
<BBB>
<CCC/>
<CCC/>
</BBB>
</AAA>
Pattern:
Root test
/AAA
: Root element is AAA
Source (XML 2)
Output
<XXX>
<BBB>
<CCC/>
<CCC/>
</BBB>
</XXX>
Pattern:
Root test
/XXX
: Root element is XXX, not AAA