|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: trying to drop leading/trailing WS text nodes from
On Wed, 3 Sep 2003 David.Pawson@xxxxxxxxxxx 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








