Schematron validation error in clustered environment with multiple nodes

91 Views Asked by At

We have a clustered environment with three nodes, and a CORB routine is used to perform Schematron validation. The validation is successful when executed on one specific ML node, but an error occurs when the routine is directed to another node. The Schematron includes a rule for 'release-date' with a data type of date. The statement substring(., 1, 4) is functional in one node but throws an error in the other node. The Schematron is available under module database.

The question at hand is why this behavior is occurring and how to address it. Despite verifying the ML Version, JAVA version, and cache clearance, the issue persists.

Schematron rule which is giving error:

    <rule context="standard//release-date"> 
        <let name="rel-y" value="substring(., 1, 4)"/>
        <let name="now-y" value="year-from-date(xs:date(current-date()))"/>
        <!--For SA or SA/SNZ, If release-date [@date-type="published" @std-type="edition"] is not blank then release-version should be '07. Published'-->            
        <report test="not(.[@date-type='published' and @std-type='edition']='') and (../std-org/std-org-abbrev='SA' or ../std-org/std-org-abbrev='SA/SNZ') and not(../release-version='07. Published')" role="error">
            [ERROR][XPATH]<value-of select="fct:generateXPath(self::node())"/>[/XPATH][rel-date_002]  When there is a publication date in release-version date-type='published', then release-version must be 07. Published, for SA's publications [/ERROR]
        </report>
        <!--release-date, Year value should not be later than current year-->
        <report test="number($rel-y) &gt; $now-y + 1" role="warning">
            [WARNING][XPATH]<value-of select="fct:generateXPath(self::node())"/>[/XPATH] [rel-date_003] <name/>:'<value-of select="."/>' is later than next year (value '<value-of select="$now-y"/>') [/WARNING]</report>
    </rule>

ML reported error: enter image description here

ML Code:

> declare function local:validate-schematron($doc)
{   
    let $extractSchematronQuery := 
      "xquery version '1.0-ml';
      let $schematronData := fn:doc('/modules/schematron/NISO-Validation-Schematron.sch')
      return $schematronData"
    let $schematron := xdmp:eval($extractSchematronQuery, (),
                    <options xmlns="xdmp:eval">
                      <database>{xdmp:modules-database()}</database>
                    </options>)
    let $validation := 
        "import module namespace schematron = 'http://marklogic.com/xdmp/schematron' at '/MarkLogic/schematron/schematron.xqy';
        declare variable $doc as node() external; 
        declare variable $schematron as node() external;
        let $xsltSchematron := schematron:compile($schematron/*)
        return
            xdmp:xslt-eval($xsltSchematron, $doc)"
    let $result :=  xdmp:eval($validation, ((xs:QName("doc"), $doc),(xs:QName("schematron"), $schematron)))
    return $result
};
0

There are 0 best solutions below