xsl-list
[Top] [All Lists]

trying to drop leading/trailing WS text nodes from verbatim

2003-09-03 04:19:00

  authoring in docbook, and i have numerous verbatim environments
that i like to write:

<programlisting>
  ... listing here ...
</programlisting>

and 

<screen>
  ... screen content here ...
</screen>


  it was just pointed out to me that, when this is rendered
into PDF, i get a leading and trailing blank line displayed
based on whitespace nodes at the beginning and the end.  to
fix this, i *could* type

<programlisting>line 1
line 2
line 3</programlisting>

and so on, but i'd rather not since that would require me
to change all my input files, and i don't even like it
aesthetically.

  rather, i'd like to design a template for any kind of
environment like that (screen, programlisting, perhaps others
as they come to mind) that would remove the first child element
only if it was a whitespace element, and similarly the last
whitespace element, then process the element normally from
then on.

  something like:

<xsl:template match="screen|programlisting">
  -- remove first/last child only if whitespace --
  -- process normally --
</xsl:template>

  is there a simple way to do this?  am i making this too
difficult?

rday


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



<Prev in Thread] Current Thread [Next in Thread>