Re: [xsl] Trimming (formatting-only) leading tabs/spaces from XSLT - issues?

Subject: Re: [xsl] Trimming (formatting-only) leading tabs/spaces from XSLT - issues?
From: Philip Fearon <pgfearo@xxxxxxxxxxxxxx>
Date: Wed, 8 Jun 2011 10:27:36 +0100
On Wed, Jun 8, 2011 at 9:15 AM, Abel Braaksma <abel.online@xxxxxxxxx> wrote:
> Hi Philip,
>
> Not sure whether this makes sense for your use case, but when considering
> white space in XSLT, you should also consider that the XSLT can be used as
> input document for the same or other XSLT as well. This is not uncommon.
> And, of course, any XSLT can contain XML segments not related to XSLT which
> may fall under the same rules as normal XML when it comes to white space
> significance.

There's certainly some complexity here that I need to consider/test
fully. Michael Kay's XSLT Programmers Reference (4th edition) has 9
pages dedicated to whitespace handling, beginning with:

    "Whitespace handling can be a source of considerable confusion."

So there are challenges to say the least. On XML Segments: The concept
provides generic XML editing capabilties, there's just special
consideration when trimming XSLT instructions.

> Keeping into consideration that the XSLT file should be treated as if it
> were any ordinary input XML (or worse, input text document, heaven forbid!)
> with all its quirks might make whitespace handling harder than it first
> seems when just looking at the XSLT itself.
>
Seen as an input text document (perhaps by a diff tool) there are
issues that have workarounds (such as reinserted trimmed formatting at
a later stage), but they're issues nonetheless. For XML-aware handling
I'm hopeful that things will be more manageable, because whitespace
issues are anticipated by XML systems and they have more context when
they encounter whitespace.

Phil fearon
http://qutoric.com

Current Thread