[xslt2] pretty-printed output: preserving whitespace inside certain elements

Hi

I need a way to specify a list of result tree elements whose content 
must not be pretty-printed (indented), so that their complete contents 
(their whitespace and that of all their descendants) is preserved.

http://lists.w3.org/Archives/Public/public-qt-comments/2003Feb/0023.html
for example proposes for the HTML output method:

   "(c) whitespace must not be added inside a formatted element, the
   formatted elements being pre, script, style, and textarea"

This reinforces my requirement to have whitespace preserved for a set of 
elements.

Now when I generate output other than (X)HTML, for example via 
indent="yes" and method="xml", then I need a way to specify this list.

This could look something like this:
   <xsl:output preserve="mypre myscript"
or
   <xsl:output preserve="*[@ws='pre']"
(the name of the attr is not important here; it could be dont-indent="", 
preserve-ws="", or etc)

When output method html or xhtml is set, this attribute would override 
the default list described in the above post.

Tobi

P.S.
In XSLT1, this is not easily achieved; it would be a welcome addition to 
XSLT2.
(xml:space="preserve" on result elements will be outup, which is not 
desired in most cases. Putting it on an xsl: ancestor can lead to 
trouble as well, for example before an indented xsl:attribute element.)
Perhaps I'm missing some existing XSLT2 feature.

-- 
http://www.pinkjuice.com/

Received on Friday, 28 February 2003 05:57:12 UTC