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

Subject: Re: [xsl] Reasons for using XSLT to validate XML instances?
From: "Wendell Piez wapiez@xxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 25 Jun 2015 14:20:56 -0000
Hi Eliot,

I agree entirely with the position that "validation" should be
considered not just in terms of a set of operations (which then tend,
more often than not, to be limited tautologically to "what validation
technologies do"), but in terms of a set of requirements.

To argue that "validation is a species (or application) of
transformation" is useful mainly, I think, in the context not of
defining what validation is or should be, but only in addressing the
supposed distinction between it and "transformation" (which has to be
understood in a similarly broad and general sense here, and also not
just as "what XSLT does"). It helps soften the (supposedly hard)
boundary lines between technologies that do different things in
different ways, by showing how there are different means to similar
(and complementary) ends. This is good for loosening the mental vise.

Of course that is more in agreement than in disagreement with your
points. One of the implications of your breakdown, in fact, is the way
it raises the question of scope. Historically, validation has been
looked on as something that could be done on each instance
independently and without reference to a broader set of instances (or
indeed other 'dynamic' aspects of system state or context). But that
isn't really the way the world works, at least not all the time.

So (and I think this is also implicit in what you said) it comes back
(as it always does) to workflow and process engineering.

Cheers, Wendell


On Wed, Jun 24, 2015 at 12:40 PM, Eliot Kimber ekimber@xxxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> I'm not sure it helps to call the validation operation a
> "transformation"--it's clearly a more general data processing activity
> that can be implemented using transformation technology (that is, systems
> optimized for doing transformation). But complete validation, including
> checking of population constraints, could involve very deep heuristics
> that go beyond what languages like XSLT or XQuery or SPARQL are intended
> to support effectively.
>
> I think it's useful to see that transformers can be used for validation
> but I'm not sure it's useful to say that validation is transformation. My
> fear is that that might limit the types of processing people consider to
> be validation.
>
> There are basically three levels of validation in the context of XML or
> similar complex structured data:
>
> 1. Validation against declarative constraints that can be checked with a
> minimum of lookahead, e.g., DTD, RELAXNG, XSD without assertions, etc.
> This type of validation is fast and the grammars used are relatively easy
> to define (mostly because they purposely omit expressive features that
> would make writing them much harder).
>
> 2. Validation against patterns that can be easily checked with something
> like XPath expressions but cannot be easily expressed in purely
> declarative constraint languages, e.g., simple Schematron and XSD 1.1
> assertions. Transformation languages like XSLT and XQuery are optimized
> for the implementation of this type of validation.
>
> 3. Validation against arbitrary business rules of any sort, including
> complex population constraint checking, consideration of transient system
> states ("must be a full moon day and not the 2nd full moon in the month"),
> etc. This type of validation can only be done using crafted procedural
> processing and, I think, falls outside the scope of what we normally think
> of as "transformation" (although, of course, it can always be implemented
> using complete languages like XSLT or XQuery if you want to, but it might
> always be easy, efficient, or maintainable).
>
> Cheers,
>
> E.
> ----
> Eliot Kimber, Owner
> Contrext, LLC
> http://contrext.com
>
>
>
>
> On 6/24/15, 11:22 AM, "Wendell Piez wapiez@xxxxxxxxxxxxxxx"
> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
>>Hi again,
>>
>>On Wed, Jun 24, 2015 at 11:27 AM, G. Ken Holman g.ken.holman@xxxxxxxxx
>><xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>>> Could you add the observation that validation (in general) is simply a
>>> transformation of an XML document into a "pass/fail against constraints"
>>> result?  For XSD, validation is also a transformation of an XML document
>>> into a PSVI, though one doesn't see that if they are just looking for
>>> pass/fail.
>>
>>Indeed, this is an important point, as I also tried to imply by
>>stressing the "what do *you* mean by validation" question.
>>
>>I can't remember who observed it first in public but it might have
>>been Ken or Eric van der Vlist? validation is just a query returning a
>>Boolean result. Of course processing pipelines such as XSD
>>implementations do more than this (with their partial validations,
>>PSVIs and so forth).
>>
>>As to Roger's examples:
>>
>>>> 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.
>>
>>Well XSLT and XQuery are perfectly equivalent, I'd say, for these
>>purposes, but it can be done with no more difficulty, really, in
>>Schematron, which as has been noted, is also just an XSLT wrapper for
>>these purposes.
>>
>>>> 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.
>>
>>That's not a validation, that's a transformation in service of
>>choreography.
>>
>>Why would I use XSLT for validation? In practice, I think the reasons
>>are more around the edges (that is, having to do with operational
>>context, not validation per se) than they are the functional
>>differences.
>>
>>Plus they work great in combination, so why choose?
>>
>>Cheers, Wendell
>>
>>
>>--
>>Wendell Piez | http://www.wendellpiez.com
>>XML | XSLT | electronic publishing
>>Eat Your Vegetables
>>_____oo_________o_o___ooooo____ooooooo_^
>>
>>
> 



-- 
Wendell Piez | http://www.wendellpiez.com
XML | XSLT | electronic publishing
Eat Your Vegetables
_____oo_________o_o___ooooo____ooooooo_^

Current Thread