Variables
Roger
Costello
Click arrow key (
) to navigate to next page
<let> Element
The <let> element is used to create variables.
You can create a variable with global scope by positioning the <let> element at the top of the schema:
<?xml version="1.0"?>
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron">
<sch:let name="foo" value=" 'Hello World' " />
...
</sch:schema>
The variable foo has the value 'Hello World'.
foo has global scope -- it can be used anywhere in the Schema.
A variable is used by preceding the variable name with a $ symbol, e.g. $foo
<let> Element (cont.)
You can create a variable that can be used only within a <pattern> by positioning the <let> element at the top of the <pattern>
You can create a variable that can be used only within a <rule> by positioning the <let> element at the top of the <rule>
Variables: An ISO Capability
You can only use variables in ISO Schematron schemas.
Variables are not available in
Schematron 1.5
Example
View the
check-classifications.sch
(example11 folder)
It creates a variable at the top of the schema, and then uses the variable in each of the three rules.
Use Oxygen XML (version 8.2 or later) to validate
valid-document.xml
and
invalid-document.xml
against the schema
Homepage
Homepage