Hello!
Can anybody help me? I want to use regular expressions in my schematron.
here my xml:
<kbl:KBL_container>
<External_reference>
<Document_type>KAB</Document_type>
<Document_number>TAB_886_016_JK_KPR_ELV_____300611</Document_number>
</External_reference>
</kbl:KBL_container>
here my schematron:
<pattern>
<rule context="//External_reference[Document_type='KAB']">
<assert test="matches(Document_number, '^.{19}EL[V|X]')">
Achtung! </assert>
</rule>
</pattern>
Is there a problem with the function "matches"?
I also for ...886_016... only numbers are allowed.
king regards
How to use function matches in schematron?
Re: How to use function matches in schematron?
Hello,
The problem is that the function matches is from XSLT/XPath 2.0 which is not enabled by default in Schematron.
If you are using Schematron 1.5(namespace http://www.ascc.net/xml/schematron) you need to activate an option in Oxygen:
Options -> Preferences, XML -> XML Parser, Schematron XPath Version: 2.0
If you are using ISO Schematron(namespace http://purl.oclc.org/dsdl/schematron) you have to add an attribute on the schema root: queryBinding="xslt2"
e.g.
Regards,
Adrian
The problem is that the function matches is from XSLT/XPath 2.0 which is not enabled by default in Schematron.
If you are using Schematron 1.5(namespace http://www.ascc.net/xml/schematron) you need to activate an option in Oxygen:
Options -> Preferences, XML -> XML Parser, Schematron XPath Version: 2.0
If you are using ISO Schematron(namespace http://purl.oclc.org/dsdl/schematron) you have to add an attribute on the schema root: queryBinding="xslt2"
e.g.
Code: Select all
<schema xmlns="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com