forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Turner <je...@apache.org>
Subject Preserving space?
Date Sun, 06 Oct 2002 13:22:43 GMT
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


Mime
View raw message