xsl-list
[Top] [All Lists]

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

2011-05-05 02:44:02
Karl Stubsjoen 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>

Your description is not very clear. do you just want a block_x with id=2? Or 
does the fact that is has no descendent text() play a role in the selection?

If only id=2 is important it would be: 

<xsl:template match="//block_x[id='2']">

-- 
Piet van Oostrum
Utrecht, NL. URL: http://pietvanoostrum.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>