[xproc-dev] <none>

Hi Folks,

I am trying to use Schematron phases with p:validate-with-schematron.

Below is my Schematron schema. It has two phases:

   1. classificationValidation

   2. reservedWordValidation

Here's the XProc for invoking the first phase:


    <p:validate-with-schematron phase="classificationValidation" name="schValidation">
        <p:input port="schema">
            <p:document href="check-classifications-and-reserved-words.sch"/>
        </p:input>
        <p:input port="parameters">
            <p:empty/>
        </p:input>
    </p:validate-with-schematron>


Unfortunately, when I run my .xpl file I get this message:

    Warning: unrecognized element sch:schema 

What am I doing wrong please?


By the way, what's the purpose of:

        <p:input port="parameters">
            <p:empty/>
        </p:input>

I've empirically discovered that without it, p:validate-with-schematron doesn't work, but I have no idea of its purpose. The specification doesn't seem to mention this port. (Nor does it mention phases)


Here's my Schematron schema (check-classifications-and-reserved-words.sch):
----------------------------------------------------------
<?xml version="1.0"?>
<sch:schema xmlns:sch="http://www.ascc.net/xml/schematron">

   <sch:phase id="classificationValidation">

      <sch:p>Validate that the document's security classification policy is valid.</sch:p>

       <sch:active pattern="SCP" />

   </sch:phase>

   <sch:phase id="reservedWordValidation">

      <sch:p>Validate that the document doesn't contain any reserved words.</sch:p>

       <sch:active pattern="RWF" />

   </sch:phase>

   <sch:pattern name="Security Classification Policy" id="SCP">

      <sch:p>A Para's classification value cannot be more sensitive 
         than the Document's classification value.</sch:p> 

      <sch:rule context="Para[@classification='top-secret']">

         <sch:assert test="/Document/@classification='top-secret'">
             If there is a Para is labeled "top-secret" then the Document  
             should be labeled top-secret
         </sch:assert>

      </sch:rule>

      <sch:rule context="Para[@classification='secret']">

         <sch:assert test="(/Document/@classification='top-secret') or
                           (/Document/@classification='secret')">
             If there is a Para is labeled "secret" then the Document  
             should be labeled either secret or top-secret
         </sch:assert>

      </sch:rule>

      <sch:rule context="Para[@classification='confidential']">

         <sch:assert test="(/Document/@classification='top-secret') or
                           (/Document/@classification='secret') or 
                           (/Document/@classification='confidential')">
             If there is a Para is labeled "confidential" then the Document  
             should be labeled either confidential, secret or top-secret
         </sch:assert>

      </sch:rule>

   </sch:pattern>

   <sch:pattern name="Reserved Word Filter" id="RWF">

      <sch:p>These reserved words are not allowed anywhere in the
         document: SCRIPT, FUNCTION.</sch:p> 

      <sch:rule context="Document">

         <sch:assert test="count(//node()[contains(.,'SCRIPT')]) = 0
                           and
                           count(//node()[contains(.,'FUNCTION')]) = 0">
             The document must not contain the words SCRIPT or FUNCTION
         </sch:assert>

      </sch:rule>

   </sch:pattern>

</sch:schema>
----------------------------------------------------------


Here's my .xpl file:
----------------------------------------------------------
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc">
        <p:input port="source">
            <p:document href="document.xml"/>
        </p:input>
        <p:output port="result">
            <p:pipe step="schValidation" port="result"/>
        </p:output>
    
    
    <p:validate-with-schematron phase="classificationValidation" name="schValidation">
        <p:input port="schema">
            <p:document href="check-classifications-and-reserved-words.sch"/>
        </p:input>
        <p:input port="parameters">
            <p:empty/>
        </p:input>
    </p:validate-with-schematron>
    
</p:declare-step>
----------------------------------------------------------

Thanks.

/Roger

Received on Saturday, 18 April 2009 22:55:34 UTC