Re: [xsl] How do you ensure that data is not altered/corrupted in a transformation?

Subject: Re: [xsl] How do you ensure that data is not altered/corrupted in a transformation?
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 19 May 2023 14:58:53 -0000
> On 19 May 2023, at 15:46, Eliot Kimber eliot.kimber@xxxxxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> Another option is to simply not use XSLT, which has a higher risk of
unintended side effects that are hard to detect by code inspection.
>
> Which XQuery is less convenient for writing transforms, its procedural
nature makes it much easier to write code that can be more completely
inspected for correctness. Dito Python, Javascript, etc.
>


I'm rather baffled by those remarks. The more declarative a language is,
surely, the more amenable it is to static analysis?

It's true that the rule-based paradigm for XSLT makes the code difficult to
analyse using data-flow approaches that are increasingly used on procedural
languages. However, if you know the schema for the input and output documents,
you can make a lot of inferences about whether the stylesheet will produce a
valid instance of the output schema given a valid instance of the input
schema.

But of course that doesn't prove you're producing correct output. That can
only be done by testing.

Michael Kay
Saxonica

Current Thread