Hi, Gnana:

Can you explain why it's necessary to validate against XSD using a single-step 
XSLT as opposed to a two-step approach that validates against the XSD using an 
XQuery validate expression and then validates against the Schematron rules that 
supplement the XSD using XSLT?

While it's possible, it's not a given that validating an XSD with templates in 
a single-step XSLT will be faster than the two-step approach.  A built-in 
validate expression might validate an XSD faster than XSLT can process the 
equivalent templates, even excluding the XSLT invocation startup costs.  The 
only way to be sure would be to code up some templates for a representative 
schema and quantify the benefits.

As Florent pointed out, you would need to generate the XSLT in advance instead 
of on request to out perform the two-step approach.

If you decide to go the conversion route, you could try to use the sc:* library 
to parse the XSD. Supporting all of the nuances of XSD (for instance, type 
restriction and substitution groups) would require a ton of work.

If you do determine that a single XSLT step is optimal, given the complexity 
allowed by XSD, you might be better off simply writing all of the rules in 
Schematron instead of trying to converting an XSD to XSLT.   


Erik Hennum
________________________________________
From: [email protected] 
[[email protected]] on behalf of Florent Georges 
[[email protected]]
Sent: Wednesday, May 11, 2016 5:46 AM
To: MarkLogic Developer Discussion; [email protected]
Subject: Re: [MarkLogic Dev General] Regarding compilation of schema for        
validation

Hi,

The standard for Schematron (ISO 19757-3) does not define how to embed
it within W3C XML Schema.  This is something *you* (your project, your
company) use.  That makes perfect sense, but you have to define how it
is done, and how to treat it.  Especially for corner cases like
imports, etc.

I would suggest you try and formalize how you embed Schematron rules
into XML Schemas at "Your Project ©".  What's allowed, what's not.

If the schemas are known at deployment, I would also strongly advise
to compile them to Schematron (extract the rules out of the XML
Schemas), and probably even to compile them to XSLT stylesheet at
build time.  So you can apply them directly, as there is no need to
compile them every time you use them if they are static.

Regards,

--
Florent Georges
http://fgeorges.org/
http://h2oconsulting.be/


On 11 May 2016 at 11:43, ? wrote:
> Thanks Florent Georges
>
> It helps a lot as we can extract the schematron and compile and use it.
>
> I am looking for any out of the box solution which can do it without 
> extracting the schematron from schema. I understand schema and schematron are 
> 2 different concepts but as we are now having schematron embedded in Schema 
> and trying to understand how best we can validate this.
>
> Also I am looking at what if schema (with schematron) is importing other 
> schemas (with schematron). Schema validation will work without issues as they 
> are referring to other schemas but schematron I am not sure how it works.
>
> Regards,
> Gnana(GP)
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of Florent 
> Georges
> Sent: 11 May 2016 10:15
> To: MarkLogic Developer Discussion; Bodireddy, Gnanaprakash (Cognizant)
> Subject: Re: [MarkLogic Dev General] Regarding compilation of schema for 
> validation
>
> On 10 May 2016 at 21:46, ? wrote:
>
> Hi,
>
>> If a schema is having a schematron with in it. Is there any way we can
>> validate both schema and schematron rules against an XML document?
>
> Have you seen my response yesterday?  Have you tried it?  It should fulfill 
> exactly that need.
>
> Regards,
>
> --
> Florent Georges
> http://fgeorges.org/
> http://h2oconsulting.be/
> This e-mail and any files transmitted with it are for the sole use of the 
> intended recipient(s) and may contain confidential and privileged 
> information. If you are not the intended recipient(s), please reply to the 
> sender and destroy all copies of the original message. Any unauthorized 
> review, use, disclosure, dissemination, forwarding, printing or copying of 
> this email, and/or any action taken in reliance on the contents of this 
> e-mail is strictly prohibited and may be unlawful. Where permitted by 
> applicable law, this e-mail and other e-mail communications sent to and from 
> Cognizant e-mail addresses may be monitored.
> _______________________________________________
> General mailing list
> [email protected]
> Manage your subscription at:
> http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to