xsl-list
[Top] [All Lists]

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

2009-04-02 07:29:09
Hello,

I did see your message on the xep mailing list and the
answer by G. Ken Holman, and I offered to send the
stylesheet I had made that does just that (currently
based on an element name for the break, not an
attribute value).

I find it's a complicated problem that I don't think
can be explained easily (not by me anyway ;-)

I'm sending the stylesheet to you in a separate
message.

If you run the stylesheet on a slightly modified version
of your source (Z instead of E when i=9):

<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"/>
                                <Z i="9" msg="get me out of here!"/>
                                <E i="10"/>
                                </D>
                        <D i="11"/>
                        </C>
                <C i="12"/>
                </B>
        </A>


you get the following result:

<root>
   <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>
   <Z i="9" msg="get me out of here!"/>
   <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>
</root>

Regards,
EB

-----Original Message-----
From: Paul Harvey [mailto:paul_harv_2(_at_)yahoo(_dot_)com]
Sent: Thursday, April 02, 2009 1:07 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Selecting everything "before" and "after" a specific node



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



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