[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] xml:output indent="yes" wins over xsl:preserve-space/xsl:strip-space?


Subject: [xsl] xml:output indent="yes" wins over xsl:preserve-space/xsl:strip-space?
From: David Sewell <dsewell@xxxxxxxxxxxx>
Date: Mon, 22 May 2006 11:12:53 -0400 (EDT)

I have an XSLT 2.0 script that I'm using to generate output with Saxon
8B, and I want confirmation that the behavior I'm getting is the
expected one.  It's not the behavior I want, but if it follows the
specs then I can't complain.

My script simply extracts all tables in an XML document and writes them
to a result document. In the source document, rows and cells are not
indented; I want them to be indented in the result document. However,
because cells can contain mixed content, I want space to be preserved
inside them.

This does not work:

   <xsl:output method="xml" indent="yes"/>
   <xsl:preserve-space elements="cell"/>

because it leads to output such as

   <cell>
      <i>some text</i>
   </cell>

The same output occurs if I use <xsl:strip-space> in place of
xsl:preserve-space. It seems, then, that xsl:output overrides
xsl:strip-space or xsl:preserve-space.

I can produce the output I want by adding "xml:space='preserve'"
as an attribute on all <cell> elements in the source. Is modifying the
source the only option I have?

DS

-- 
David Sewell, Editorial and Technical Manager
Electronic Imprint, The University of Virginia Press
PO Box 400318, Charlottesville, VA 22904-4318 USA
Courier: 310 Old Ivy Way, Suite 302, Charlottesville VA 22903
Email: dsewell@xxxxxxxxxxxx   Tel: +1 434 924 9973
Web: http://www.ei.virginia.edu/


Current Thread
Keywords