Whitespace, the Final Frontier

xslt for dummies
Chapter 18 - Ten Most Confusing Things About XSLT
XSLT For Dummies
by Richard Wagner
Hungry Minds 2002

You need to think about several factors as you consider whitespace in your result document, because whitespace has origins in both your XSLT stylesheet and the underlying XML source document.

Inside the XSLT stylesheet, whitespace is usually stripped out of the template before any transformation occurs. However, whitespace is preserved in the following cases:

  • Text nodes that contain nonwhitespace characters .

  • Any whitespace text appearing inside a xsl:text element.

  • When the closest ancestor of a text node has an xml:space attribute with the value of preserve .

Whitespace inside the source XML document follows similar rules, except that you can declare default whitespace rules by using the xsl: preserve-space or xsl: strip-space instructions. Therefore, any text node that occurs inside the range of xsl:preserve-space is preserved.

See Chapter 13 for more details on whitespace.

2000-2002    Feedback

XSLT For Dummies
XSLT for Dummies
ISBN: 0764536516
EAN: 2147483647
Year: 2002
Pages: 148

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net