Re: [xsl] Find node with no child text() nodes

Subject: Re: [xsl] Find node with no child text() nodes
From: Brandon Ibach <brandon.ibach@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 4 May 2011 20:53:23 -0400
<xsl:template match="block_x[not(descendant::text())]">...</xsl:template>

However, depending on your space-stripping settings, the indenting
whitespace (present in the model as text() nodes) might foil this.
So, you could also try:

<xsl:template match="block_x[normalize-space(.) = '']">...</xsl:template>

-Brandon :)


On Wed, May 4, 2011 at 8:12 PM, Karl Stubsjoen <kstubs@xxxxxxxxx> wrote:
> Need help with XSLT 1.0 template please.
> How do you match on block_x when no descendant text() nodes exist?
> Note:  there is no predictive knowledge of the depth of block within
block_x.
> In sample below, block_x id 2 should match.
> Like:
> <blocks>
>   <block_x id="1">
>     <block/>
>     <block/>
>     <block>asdf</block>
>   </block_x>
>   <block_x id="2">
>     <block/>
>     <block>
>        <sub_block/>
>     </block>
> </block_x>
> </blocks>
>
>
> Karl..
> --
> Karl Stubsjoen
> MeetScoresOnline.com
> (602) 845-0006

Current Thread