How do i select all text nodes using XSL?

Posted by user323719 on Stack Overflow See other posts from Stack Overflow or by user323719
Published on 2010-04-22T21:58:20Z Indexed on 2010/04/22 22:13 UTC
Read the original article Hit count: 245

Filed under:
|
|
|
|

I want to get the generate-id(.) of all the text nodes after node and before node . I am looking for some generic XSL and not tightly coupled to the sample input pattern mentioned below. For any input pattern i want to get the ids of all the text nodes between node and .

Sample input for better understanding:

<a>
  <b> 
    <c>
      This is first text node
    </c> 
  </b> 
  <d> 
    <e>
      This is my second text node
    </e> 
    <f> 
      This is my <m/>third text node 
    </f> 
    <g>
      One more text node
    </g>
  <h>
    <i>
      This is my fourth text node
    </i>
  </h>
  <j> 
    This is my fifth <n/>text node 
  </j>
  <k> 
    <l>
      This is my sixth text node 
    </l>
  </k>     
</d> 
</a> 

Expected output: Generate id of the text nodes with values "third text node ", "One more text node", "This is my fourth text node", "This is my fifth" which lie inbetween nodes <m/> and <n/>

Please give your ideas.

© Stack Overflow or respective owner

Related posts about xslt

Related posts about xsl