xsl-list
[Top] [All Lists]

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

2011-05-04 19:53:39
<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(_at_)gmail(_dot_)com> 
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

--~------------------------------------------------------------------
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>
--~--



--~------------------------------------------------------------------
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>