Comment by notfed
5 months ago
Does it preserve whitespace? Something that I always found asinine about XSLT is that it wipes out whitespace when transforming. Imagine you have thousands of corporate XML files in source control, and you want to tranform them all, performing some simple mutation. XSLT claims to be fit for this job, but in practice your diff is going to be full of unintentional whitespace mangling.
XSLT will perform the transformations that you instruct it to do. It does not wipe out whitespace just on its own. Do you mean that you'd like facilities to nicely reindent the output?
> It does not wipe out whitespace just on its own.
Sounds nice but doesn't match my lived experience with both Chrome's built-in XSLT processor and `xsltproc`. (I was using XSLT 1.0, for legacy reasons, so maybe this is an XSLT 1.0 issue?)
> Do you mean that you'd like facilities to nicely reindent the output?
No, I do mean preserve whitespace (i.e., formatting), such as between elements and between attributes.
usually whitespace (in) significance is specified in the XML schema. so if you provide a schema and instruct the xslt engine to comply with the schema, do your issues persist?