You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jeroen Cranendonk <j....@emaxx.nl> on 2003/03/12 09:23:22 UTC
Fw: using abstract rules in validation schema
----- Original Message -----
From: "Robert Kromkamp" <ro...@emaxx.nl>
To: "Jeroen Cranendonk" <j....@emaxx.nl>
Sent: Wednesday, March 12, 2003 10:16 AM
Subject: using abstract rules in validation schema
> Hi All,
>
> According to the DTD the beneath schema structure is possible. But when I
> use this I get the following error, who can help me?
>
> -----
> An error occurredorg.apache.avalon.framework.CascadingRuntimeException
> Failed loading validating schema
> org.apache.avalon.framework.CascadingRuntimeException: Failed loading
> validating schema org.apache.commons.jxpath.JXPathException: No value for
> xpath: /schema/pattern[1]/rule[1]/@contextOriginal exception :
> org.apache.avalon.framework.CascadingRuntimeException: !!! Failed loading
> Schematron schema at
>
org.apache.cocoon.components.validation.schematron.SchematronFactory.compile
> Schema(SchematronFactory.java:123) at
>
org.apache.cocoon.acting.AbstractXMLFormAction.getFormValidator(AbstractXMLF
> ormAction.java:398) at
>
org.apache.cocoon.acting.AbstractXMLFormAction.getForm(AbstractXMLFormAction
> .java:218) at
>
org.apache.cocoon.acting.AbstractXMLFormAction.act(AbstractXMLFormAction.jav
> a:237) at
>
org.apache.cocoon.components.treeprocessor.sitemap.ActTypeNode.invoke(ActTyp
> eNode.java:139) at
>
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invo
> keNodes(AbstractParentProcessingNode.java:84) at
>
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invok
> e(PreparableMatchNode.java:164) at
>
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invo
> keNodes(AbstractParentProcessingNode.java:108) at
>
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(Pipel
> ineNode.java:153) at
> -----
>
>
> <schema xmlns="http://www.ascc.net/xml/schematron">
> <title>For Rusty's Inquiring Students</title>
> <p>This is an example of creating a datatype using Schematron's
> "abstract rules"
> and using them. </p>
>
> <pattern>
>
> <!-- Define an abstract rule on a data value (i.e. a type) for
> nt -->
> <rule abstract="true" id="int">
> <assert test="string-length(string-normalize(./text())) >
0"
> >This element must contain a value.</assert>
> <assert test="number(./text())"
> >This element should contain an int. An int it a
> number.</assert>
> <assert test="floor(number(./text())) =
> ceiling(number(./text())) "
> >This element should contain an int. An int is a whole
> number.</assert>
> <assert test="number(./text()) < 2147483647"
> >This element should contain an int. An int is less than
> 2^31-1.</assert>
> <assert test="number(./text()) >= -2147483648"
> >This element should contain an int. An int is greater
> than -(2^31).</assert>
> </rule>
>
> <!-- Make the assertions -->
> <rule context="someElement" >
> <extends rule="int" />
> </rule>
> <rule context="someOtherElement">
> <extends rule="int" />
> <assert test="number(./text()) > 1969"
> >This element should contain a year since 1969</assert>
> </rule>
> <pattern>
> </schema>
>
> Thanks,
> Robert Kromkamp
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org