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: "Eliot Kimber eliot.kimber@xxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 19 May 2023 15:14:08 -0000
Im probably thinking about it too informallyif I simply inspect a set of
XSLT modules its difficult to know if Ive overlooked some way that a given
input might be processed (or not processed) in some unexpected way. This is
very different from a programmatic analysis of the code itself.

But at least in my experience writing a lot of XSLTs, the bugs I tend to have
are the result of not accounting for some aspect of the input that then fails
to match the expectations of the templates, meaning something is handled by a
template it shouldnt have been or isnt handled when it should be or ends up
being handled by a template in another module where it was not obvious from
inspection alone that the module would do that (a side effect of the powerful
code modularity and layering features of XSLT).

So as a lone implementor trying to make reliable code where provable accuracy
is the highest requirement, I would likely choose an implementation language
that I, as a human, can more reliably inspect for correctness, at the cost of
implementation convenience.

But that also suggests that Im probably the wrong person to be implementing
that application in the first place.

Or maybe I just need to learn how to take advantage of programmatic code
analysis.

Cheers,

E.
_____________________________________________
Eliot Kimber
Sr Staff Content Engineer
O: 512 554 9368
M: 512 554 9368
servicenow.com<https://www.servicenow.com>
LinkedIn<https://www.linkedin.com/company/servicenow> |
Twitter<https://twitter.com/servicenow> |
YouTube<https://www.youtube.com/user/servicenowinc> |
Facebook<https://www.facebook.com/servicenow>

From: Michael Kay mike@xxxxxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Friday, May 19, 2023 at 10:05 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: [xsl] How do you ensure that data is not altered/corrupted in a
transformation?
[External Email]

________________________________



On 19 May 2023, at 15:46, Eliot Kimber
eliot.kimber@xxxxxxxxxxxxxx<mailto:eliot.kimber@xxxxxxxxxxxxxx>
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx<mailto:xsl-list-service@xxxxxxxxxxxx
rytech.com>> 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

XSL-List info and archive<http://www.mulberrytech.com/xsl/xsl-list>
EasyUnsubscribe<http://lists.mulberrytech.com/unsub/xsl-list/3453418> (by
email<>)

Current Thread