Re: [xsl] not matching empty text nodes.

Subject: Re: [xsl] not matching empty text nodes.
From: Joerg Heinicke <joerg.heinicke@xxxxxx>
Date: Tue, 11 Feb 2003 01:09:02 +0100
Terence wrote:
This message is late because it bounced due to me not using the right from address...

On Sun, 09 Feb 2003 09:38:46 +0100, "Joerg Heinicke"
<joerg.heinicke@xxxxxx> said:

Maybe it already matches your needs, but I think it's better to use


That is the behaviour I was looking for, however I see your point.


xsl:template match="photo/*[normalize-space()]"


To make it more obvious to anyone else developing this template, I ended up with this.

<xsl:apply-templates
select="/album/photos/photo/*[count(descendant::node())=0]" />

You don't need to count the *descendants*, childs are enough.


<xsl:apply-templates select="/album/photos/photo/*[count(child::node())=0]"/>

You don't need to *count* the childs, simply testing if there is any is enough (child axis is implicit, you can remove 'child::', if you want):

<xsl:apply-templates select="/album/photos/photo/*[not(node())]"/>

<xsl:template match="photo/*[normalize-space(text())!='']">

!='' is implicit, you can remove it if you want.


<xsl:template match="photo/*[normalize-space(text())]">

Regards,

Joerg


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



Current Thread