Re: [xsl] How to declaratively describe a mapping that involves breaking a string apart and reassembling the parts with an additional symbol?

Subject: Re: [xsl] How to declaratively describe a mapping that involves breaking a string apart and reassembling the parts with an additional symbol?
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 12 Mar 2024 15:51:48 -0000
> Bonus points if you can also answer this question:
>
> Computer Science Theory Question: If it is impossible to declaratively
express the above mapping, does that mean there is a limit to declarative
descriptions? Is the set of declarative descriptions smaller than the set of
procedural descriptions?
>

My computer science theory is very rusty, but I don't think that "declarative"
and "procedural" have formal definitions that you can appeal to.

A distinction you might make is between rules expressed in first order
predicate calculus, and rules that require recursion. But "first order
predicate calculus" doesn't prescribe a particular set of arithmetic or string
operators.

The expression

`<magneticVariationValue>concat(substring($magVar,2,3),'.',substring($magVar,
5,1))</magneticVariationValue>`

is only procedural in the sense that it is written in a Turing complete
language. If you regard it as being written in a language that is much smaller
than XPath, does that make it more declarative?

For a reductio ad absurdum, consider 2+2. Declarative or procedural?

Michael Kay
Saxonica

Current Thread