xsl-list
[Top] [All Lists]

Re: [xsl] XPath to Find All Siblings Except Self

2012-03-15 12:54:35
You could use the union of preceding and following siblings:

  ( preceding-sibling::section | following-sibling::section)/title

I hope this helps.

. . . . . . . Ken

At 2012-03-15 13:51 -0400, Rick Quatro wrote:
I have the following XML file:

<?xml version="1.0" encoding="UTF-8"?>
<chapter>
    <section level="1">
        <title id="1003261">Camshaft Cover</title>
        <section level="2">
            <title id="1003269">Removal</title>
            <paragraph id="1003264"/>
        </section>
        <section level="2">
            <title id="1003262">Rebuilding</title>
            <paragraph id="1003265"/>
        </section>
        <section level="2">
            <title id="1003321">Installation</title>
            <paragraph id="1003322"/>
        </section>
    </section>
</chapter>

When my context is a particular level 2 section element, I need to find all
of the title elements of the sibling level 2 elements, except for the
current level 2 section's title. So, for example if my context is the
Removal section, I want to find the Rebuilding and Installation titles. I am
using this, but it is returning all of the level 2 titles:

parent::section/section[not(self)]/title

Thanks in advance for any help.

Rick Quatro
Carmen Publishing Inc.
*** 585-283-5045 *** NEW NUMBER
rick(_at_)frameexpert(_dot_)com
http://www.frameexpert.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>
--~--


--
Contact us for world-wide XML consulting and instructor-led training
Free 5-hour video lecture: XSLT/XPath 1.0 & 2.0 http://ude.my/uoui9h
Crane Softwrights Ltd.            http://www.CraneSoftwrights.com/s/
G. Ken Holman                   mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Google+ profile: https://plus.google.com/116832879756988317389/about
Legal business disclaimers:    http://www.CraneSoftwrights.com/legal


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