You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by Jeff Turner <je...@apache.org> on 2002/10/06 15:22:43 UTC
Preserving space?
Hi,
I have some source XML whose element's whitespace shouldn't be lost:
<project>
<description>
Anteater demo
-------------
1. sdflsdf
2. sdflsdfkj
</description>
</project>
(background: I'm using XPathDirectoryGenerator to extract
these descriptions from a directory of Ant scripts)
The official way to indicate significant whitespace is the
xml:space="preserve" attribute. How about adding support for it to
document2html.xsl?
<xsl:template match="p[@xml:space='preserve']">
<div class="pre">
<xsl:apply-templates/>
</div>
</xsl:template>
And then in style.css:
.pre { white-space: pre;}
The intention here is to preserve whitespace without also getting the
monospace font and block display that <pre> uses.
Does this sound decent? Any better ideas for preserving whitespace?
--Jeff