Re: [xsl] indenting maps on write

Subject: Re: [xsl] indenting maps on write
From: "Graydon graydon@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 3 Apr 2024 11:22:42 -0000
On Wed, Apr 03, 2024 at 01:43:53AM -0000, Willem Van Lishout willemvanlishout@xxxxxxxxx scripsit:
> In my experience, this is hard to get right. It shows that XML attributes
> weren't really conceived with the idea to write code in them.
> 
> Some ideas:
> - Modify the XML parser to not do attribute normalisation (if possible
> in your environment)

That would not be viewed with favour.

> - Maybe try parsing the map using xsl:evaluate and reconstruct it?
> Although then you will probably encounter other issues, e.g. I believe
> key order is non-deterministic.

Yeah. The core issue here is to not set off false positiives from change
detection in a linewise, rather than node-aware, diff process in a
source control system. Any fragile special processing is not likely to
help in this respect.

> - Use <xsl:map>

Can't mark a variable defined using xsl:map as static, which I would at
least like to be able to do. (Which makes sense; the XPath map is text,
xsl:map contains a sequence constructor.)

> - Explain your colleagues how it works and tell them to live with it.

This would not appear to be a viable option.

I'm now wondering if I can hive all the variable definitions off into
a file I include but need not auto-update with the instance number.
That hasn't been an option before but I am no longer required to use SEF
files to deploy the transform.

Thanks!

-- Graydon

-- 
Graydon Saunders  | graydonish@xxxxxxxxxxxx
^fs oferiode, pisses swa mfg.
-- Deor  ("That passed, so may this.")

Current Thread