xsl-list
[Top] [All Lists]

Re: [xsl] Reasons for using XSLT to validate XML instances?

2015-06-24 09:20:20
Hi Folks,

Thank you very much for your excellent responses!

Below is a summary of your responses. I welcome further additions and edits.  

-----------------------------------------------
      Niche for XSLT Validation
-----------------------------------------------
XSLT can be used to validate XML instance documents. However, there already 
exists standards-supported XML validation technologies: XML Schema and 
Schematron (and others). Whenever possible, XML Schema and Schematron should be 
used for validation. 

Is there a niche for XSLT validation? Are there validation problems that only 
XSLT can solve? 

XML Schemas can validate only one XML document, it cannot validate across XML 
documents. XSLT can operate on multiple XML documents, so perhaps 
cross-document validation is a niche that only XSLT can fill? Not so, as 
Schematron can validate across documents. 

Here are two validation problems that can only be solved using XSLT validation:

1. Customized validation report: XSLT can validate and generate a customized 
validation report.

2. Filtered result: As XSLT performs validation on an XML instance document it 
can eliminate the parts that are invalid.

There are validation problems that are more easily solved using XSLT. Whether 
one validation approach is easier or harder is subjective. Nonetheless, here 
are a couple validation problems that are arguably more easily solved using 
XSLT:

1. In a collection of XML documents, validate that the value of each <name> 
element is unique.

2. Consider a test suite consisting of a collection of XML Schemas and a 
collection of XML instance documents. Each instance document contains metadata 
to indicate which XML Schema should be used to validate it. XSLT can be used to 
consult the metadata and then launch the appropriate XML Schema.
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>