Re: [xsl] Validating against schema subset

Subject: Re: [xsl] Validating against schema subset
From: Colin Paul Adams <colin@xxxxxxxxxxxxxxxxxx>
Date: 08 Nov 2005 07:15:06 +0000
>>>>> "Amrit" == Amrit Pal Singh <ampsingh@xxxxxxxxx> writes:

    Amrit> Hi, Is it possible to validate a xml against subset of a
    Amrit> schema. I'm having a xml file which is going to be part of
    Amrit> a bigger xml file. For the bigger xml file, I'm having xml
    Amrit> schema to validate against. Before adding my xml file to
    Amrit> bigger xml file, I need to validate against particular
    Amrit> element definition in the schema file.  Is there anyway to
    Amrit> do it?

I should think this is possible using schema-aware XSLT 2.0.

A variant on the identity transform. Specify
default_validation="strip" on the xsl:transform/stylesheet element
(this isn't necessary, but it helps to document the purpose of the
transformation, I think).
Then add template rules to match the elements you wish to validate.
The body of the template should be an xsl:copy-of instruction with 
validation="strict" spefified.

Untested.
-- 
Colin Adams
Preston Lancashire

Current Thread