xsl-list
[Top] [All Lists]

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

2011-06-07 10:04:06
On Tue, Jun 7, 2011 at 2:59 PM, David Carlisle 
<davidc(_at_)nag(_dot_)co(_dot_)uk> wrote:
On 07/06/2011 13:47, Philip Fearon wrote:

 more effectively than text-only tools, trimming XSLT of
tabs/spaces therefore shouldn't be a problem a

well so long as the thing that was trimming knew enough xslt syntax not to
trim significant white space, which means knowing the interrelation between
xsl:text xsl:strip-space xsl:preserve-space and xml:space, and in general
(to know if xsl:strip-space or xsl:preserve-space apply), it needs to know
full xslt pattern matching behaviour.
(in practice you might want to assume that xsl:strip-space xsl:preserve
space and xml:space aren't applied to the xsl file, which simplifies things,
but will lead to failures in edge cases).

Yes, xslt has well defined white space handling rules, this makes
things somewhat easier.

However even if the white space formatter does only change insignificant
white space, so the reformatting won't affect XML processing, it can be
terribly annoying (and space costly) if the code is being stored in a source
code repository that (essentially) is storing line based diffs. If every
time you touch the file it reflows it (or converts all line endings or
whatever) then that ends up with a much bigger than expected diff showing up
in change log at each stage.

Yes, a potential issue, though lines by wouldn't be reflowed by
default. - I guess similar problems apply if someone accidentally
presses 'pretty-print' in the middle of a 'conventional' editing
session (there must be editor options to prevent this happening too).
Perhaps it would be worthwhile to be able to reinsert formatting that
strictly conformed to a configuration file, or, simpler still, a
sample XML file used as a model defining what formatting characters to
insert when editing is finished? - Most formatting is regular, but
I've notice that attribute names and values in particular sometimes
align with preceding names/values, but sometimes skip back to a
minimally indented position. Also some developers don't insert (quite
deliberately) indentation for elements prior to the first xsl:template
element, for example. Hopefully the commonly used diff tools treat XML
comments as insignificant because there are some potential issues
there too.

Phil Fearon
Qutoric


David


________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs.
________________________________________________________________________


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--