wiki:HowToMigrateSchematronRulesToISOSchematron

How-to update schematron rules to ISO 19757-3 ?

GeoNetwork (before 2.5.0) was using Schematron 1.x series which has been taken over by ISO Schematron implementation. This how-to describes the way to update rules define in 1.x to be used in ISO Schematron.

More information:

Update namespace

Namespace in ISO Schematron is: http://purl.oclc.org/dsdl/schematron

-<sch:schema xmlns:sch="http://www.ascc.net/xml/schematron">
+<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron">

Use sch:title instead of sch:pattern/@name

sch:title is now used to store the title of the rule.

Example:

-       <sch:pattern name="$loc/strings/M6">
+       <sch:pattern>
+               <sch:title>$loc/strings/M6</sch:title>

(optional) Improve report

In order to improve report information, the use of sch:let to test the existence of an element in combinaison with sch:assert in case of error and sch:report in case of success improve report readability.

sch:value-of could be use to report variable information in report.

    <sch:pattern>
        <sch:title>$loc/strings/M500</sch:title>
        <sch:rule
            context="//gmd:MD_Metadata|//*[@gco:isoType='gmd:MD_Metadata']">
            <sch:let name="language" value="gmd:language/gco:CharacterString"/>
            <sch:let name="localeAndNoLanguage" value="not(gmd:locale and gmd:language/@gco:nilReason='missing')
                and not(gmd:locale and not(gmd:language))"/>
      
            <!--  Check that main language is not defined and gmd:locale element exist. -->
            <sch:assert test="$localeAndNoLanguage"
                >$loc/strings/alert.M500</sch:assert>
            <sch:report test="$localeAndNoLanguage"
                ><sch:value-of select="$loc/strings/report.M500"/> "<sch:value-of select="$language"/>"</sch:report>

Compile

Then use the "ant schematron" in schematron directory to publish your rules to schema folders.

Last modified 10 years ago Last modified on Nov 7, 2013, 9:06:20 AM
Note: See TracWiki for help on using the wiki.