Changes between Initial Version and Version 1 of HowToMigrateSchematronRulesToISOSchematron


Ignore:
Timestamp:
Apr 13, 2010, 4:28:32 AM (14 years ago)
Author:
fxp
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • HowToMigrateSchematronRulesToISOSchematron

    v1 v1  
     1
     2= How-to update schematron rules to ISO 19757-3 ? =
     3GeoNetwork (before 2.5.0) was using Schematron 1.x series which has been taken over by ISO Schematron implementation.
     4This how-to describes the way to update rules define in 1.x to be used in ISO Schematron.
     5
     6More information:
     7 * http://www.schematron.com/
     8
     9== Update namespace ==
     10Namespace in ISO Schematron is: http://purl.oclc.org/dsdl/schematron
     11
     12{{{
     13-<sch:schema xmlns:sch="http://www.ascc.net/xml/schematron">
     14+<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron">
     15}}}
     16
     17== Use sch:title instead of sch:pattern/@name ==
     18sch:title is now used to store the title of the rule.
     19
     20Example:
     21{{{
     22-       <sch:pattern name="$loc/strings/M6">
     23+       <sch:pattern>
     24+               <sch:title>$loc/strings/M6</sch:title>
     25}}}
     26
     27== (optional) Improve report ==
     28In 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.
     29
     30sch:value-of could be use to report variable information in report.
     31{{{
     32    <sch:pattern>
     33        <sch:title>$loc/strings/M500</sch:title>
     34        <sch:rule
     35            context="//gmd:MD_Metadata|//*[@gco:isoType='gmd:MD_Metadata']">
     36            <sch:let name="language" value="gmd:language/gco:CharacterString"/>
     37            <sch:let name="localeAndNoLanguage" value="not(gmd:locale and gmd:language/@gco:nilReason='missing')
     38                and not(gmd:locale and not(gmd:language))"/>
     39     
     40            <!--  Check that main language is not defined and gmd:locale element exist. -->
     41            <sch:assert test="$localeAndNoLanguage"
     42                >$loc/strings/alert.M500</sch:assert>
     43            <sch:report test="$localeAndNoLanguage"
     44                ><sch:value-of select="$loc/strings/report.M500"/> "<sch:value-of select="$language"/>"</sch:report>
     45}}}
     46
     47== Compile ==
     48Then use the "ant schematron" in schematron directory to publish your rules to schema folders.