[xsl] xsl:output/@indent="yes" and *[@xml:space="preserve"]

Subject: [xsl] xsl:output/@indent="yes" and *[@xml:space="preserve"]
From: Gunther Schadow <gunther@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 04 Feb 2003 15:33:21 -0500

suppose I run the following transform (on anything)

<xsl:transform version="1.0"
  <xsl:output method="xml" indent="yes"/>
  <xsl:strip-space elements="*"/>
  <xsl:template match="/">
      <span xml:space="preserve"><xsl:text>&#xA;</xsl:text></span>

In Saxon this produces the following output

<?xml version="1.0" encoding="utf-8"?>
   <span xml:space="preserve">


however, I submit this is not correct, or at least not what I
would expect. If space is to be preserved on the span element,
then I would hope that no space is added either. IMO the output
should be:

<?xml version="1.0" encoding="utf-8"?>
   <span xml:space="preserve">

i.e., there should be a single newline only, even though that
somewhat messes up the XML prettyness.

Is this something that Saxon just happens to get wrong or is this
something that the XSLT spec leaves open to interpretation, or
does the XSLT spec actually require this behavior? If the latter
is true, how can one preserve space precisely on certain elements
without having to choose xsl:output/@indent="no"?


-- Gunther Schadow, M.D., Ph.D. gschadow@xxxxxxxxxxxxxxx Medical Information Scientist Regenstrief Institute for Health Care Adjunct Assistant Professor Indiana University School of Medicine tel:1(317)630-7960 http://aurora.regenstrief.org

XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list

Current Thread