xsl-list
[Top] [All Lists]

[xsl] Selecting everything "before" and "after" a specific node

2009-04-02 07:09:41

Hi,
I’ve searched and posted on another list, but have not found an answer to this 
problem…
I have XML like this...

<A i=”1”>
      <B i=”2”>
            <C i=”3”/>
      </B>
      <B i=”4”>
            <C i=”5”>
                  <D i=”6”/>
                  <D i=”7”>
                        <E i=”8”/>
                        <E i=”9” msg="get me out of here!"/>
                        <E i=”10”/>
                  </D>
                  <D i=”11”/>
            </C>
            <C i=”12”/>
      </B>
</A>
And I need to break it out into 3 nodesets, delimited by the <E i=”9” msg="get 
me out of here!"/> such that I’d end up with...
<ROOT>
       <BEFORE>
        <A i=”1”>
                  <B i=”2”>
                        <C i=”3”/>
                  </B>
                  <B i=”4”>
                        <C i=”5”>
                              <D i=”6”/>
                              <D i=”7”>
                                    <E i=”8”/>
                              </D>
                        </C>>
                  </B>
        </A>
       </BEFORE>
       <PULLED_OUT>
            <E id=”9” msg="get me out of here!"/>
       </PULLED_OUT>
       <AFTER>
        <A i=”1”>
                  <B i=”4”>
                        <C i=”5”>
                              <D i=”7”>
                                    <E i=”10”/>
                              </D>
                              <D i=”11”/>
                        </C>
                        <C i=”12”/>
                  </B>
        </A>
       </AFTER>
</ROOT>

Any suggestions as to how I’d go about that?
I've spent some time with preceding and following axis, and some other 
conditions, but this has not got me where I need to get as yet.

Thanks so much,

Paul





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