On Wed, 3 Sep 2003 David(_dot_)Pawson(_at_)rnib(_dot_)org(_dot_)uk wrote:
Robert, if you try your solution you make conclude, as I did,
that the spacing offsets the listings nicely, rather
than 'mixing' them too closely with the surrounding text?
regards DaveP
i thought about that, but decided i wanted to use the verbatim
before/after spacing attributes to control that more precisely.
but there was one thing about the posted solution that i found
curious, and it has to do with programming practice (just note the
overall structure of the test below):
<xsl:variable name="contsl">
<xsl:choose>
<xsl:when test="count($before) = 0">
<xsl:call-template name="remove-lf-left">
<xsl:with-param name="astr" select="$conts"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$conts"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
note that the above code tests for two possibilities -- that
count($before) = 0, or it doesn't. fair enough, but from years
of recursive programming, i'm used to putting the trivial condition
at the top, to get it out of the way quickly. so i could have
just as easily written this as:
count($before) > 0 --> trivial
else --> recursive call
clearly, the solutions are equivalent, but do folks have any
strong opinions on *recommended* practice?
as i said, i've always been a fan of trying to recognize and
deal with trivial conditions as soon as possible, to make the
code easier to read top-down.
thoughts?
rday
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list