RE: preserve-space

Subject: RE: preserve-space
From: Mike Brown <mbrown@xxxxxxxxxxxxx>
Date: Wed, 10 Nov 1999 15:33:50 -0700
Clay Rowland wrote:
> I am having a hard time understanding how to implement this 
> tag.  The spec says to list the elements that I would like
> to preserve space for like this: 
> <xsl:preserve-space elements="..."/>
> 
> is the list of elements just space delimited like so:  
> elements="elem1 elem2 elem3"?

Yes, the spec says so at http://www.w3.org/TR/xslt#strip.

"For source documents, the set of whitespace-preserving element names is
specified by xsl:strip-space and xsl:preserve-space top-level elements.
These elements each have an elements attribute whose value is a
whitespace-separated list of NameTests." 

A NameTest is an asterisk or element name, with or without a prefix.

"Initially, the set of whitespace-preserving element names contains all
element names."

<xsl:preserve-space> is for overriding this initial set with a subset. What
are being preserved are the child text nodes (of these elements) that
contain nothing but whitespace.

> what i would really like is to preserve the white space 
> of the entire xsl style sheet as well as the xml elements.

"For stylesheets, the set of whitespace-preserving element names consists of
just xsl:text."

In other words, whitespace-only text nodes are always stripped from the
stylesheet, except for those that are children of <xsl:text> elements.

Post a brief example XML and XSL document, what XSL processor you're using,
and what is it about the output that you want to change.

-Mike


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


Current Thread