xsl-list
[Top] [All Lists]

Re: normalize-space and newlines

2005-08-23 23:10:50
Date: Wed, 24 Aug 2005 00:32:28 -0400
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
From: david_n_bertoni(_at_)us(_dot_)ibm(_dot_)com
Subject: Re: [xsl] normalize-space and newlines
Message-ID: <OF8DBA1050.3B254F3A-ON88257067.00172602->
88257067(_dot_)00191C5B(_at_)lotus(_dot_)com>

Hi David, thanks for your help.

This template has no "mode" attribute, so it's never matched.
 This brings up the question as to why you are using modes at all,
when all of your templates have apply-templates instructions that
all use the same mode.

Um, because I don't know what I'm doing :-)
I copied somebody's identity template and it used mode="copy" throughout.
I added the normalize-space in a template matching text() items because it
looked like I could do it in the same pass (and I can, just not the way I
was doing it; I presumed that setting a higher priority would be enough).

<!-- non-empty: has children, is a text node, has value or attribute -->
<xsl:if test="node() or * or text() or string(.) or @*">

The expression of the xsl:if "test" attribute seems strange to me.

And to me, it got to be what it was because terser expressions always seemed
to let stuff through that I didn't want to keep.

Is there any reason why you don't have a separate template for element
nodes?
<!-- Drop any empty elements -->
<xsl:template match="*[not(node())]" mode="copy" />

I tried this with match="not(node())" which did not do what I wanted. Didn't
try *[note(node())] because expressions like that don't seem to occur to me
yet :-(

Cheers
Trevor



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



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