[xsl] trying to drop leading/trailing WS text nodes from verbatim

Subject: [xsl] trying to drop leading/trailing WS text nodes from verbatim
From: "Robert P. J. Day" <rpjday@xxxxxxxxxxxxxx>
Date: Wed, 3 Sep 2003 07:19:00 -0400 (EDT)
  authoring in docbook, and i have numerous verbatim environments
that i like to write:

  ... listing here ...


  ... screen content here ...

  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

  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 --

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


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

Current Thread