xsl-list
[Top] [All Lists]

Matching certain elements following an element

2005-11-04 13:24:14
Hello,

I have an interesting problem here, and I am unsure how to go about solving it.

I have the following xml:

<f>
   <b>
       <h2><a>foo</a></h2>
       <p>......</p>
       <p>......</p>
       <p>......</p>
       <img>....</img>
       <p>......</p>
       <div>
           <h2><a>bar</a></h2>
           <ul>
               <li>.....</li>
               <li>.....</li>
               <li>.....</li>
               <li>.....</li>
           </ul>
<p>...</p> <h2><a>baz</a></h2>
       </div>
       <foo>....</foo>
       <a>......</a>
       <p>......</p>
       <p>......</p>
       <baz/>
   </b>
</f>

I need to pass the template a parameter, I will call this $section, and then I 
need the stylesheet to return whatever is in that section. So for example, if 
$section = 'foo', it would match the h2/a/text() = foo, and return everything 
up to the next h2/a. So it would return:
 <p>......</p>
 <p>......</p>
 <p>......</p>
 <img>....</img>
 <p>......</p>

Or if $section = 'baz', I need to get:
 <foo>....</foo>
 <a>......</a>
 <p>......</p>
 <p>......</p>
 <baz/>

And so on. Now, the problem is, there is <div> elements mixed in there. I want 
to completely ignore these. Any ideas on how I could go about achieving this?

Thanks,
-- Matthew


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