xsl-list
[Top] [All Lists]

XPATH restricting preceding nodes

2003-09-10 01:57:26

Hi,

I have something like the following XML document:

<top>
        <page>
                <entry text='aaa'/>
                <entry text='bbb'/>
                <entry text='aaa'/>
        </page>
        <page>
                <entry text='ccc'/>
                <entry text='bbb'/>  ***
                <entry text='ccc'/>             
        </page>
</top>

I only want to select entries with the same text once for each page.
For the first page I want to get only one aaa-entry and one bbb-entry.
For the second page I want to get only one ccc-entry and ond bbb-entry.

I did this with the following XPATH expression :
        <xsl:for-each select="ancestor::page/descendant::entry[not(@text = 
preceding::entry/@text)]">

but then I don't get the bbb-entry for the second page. 
I cannot figure out a way to restrict the preceding::entry result set to the 
current page.
What am I doing wrong?

Thanks

..............................

Erwin Kloeck
Produktentwicklung

Oestreicher + Wagner 
Medientechnik GmbH
Frankenthaler Strasse 20
D-81539 Muenchen

Fon   +49 (0)89-68961 216 
Fax   +49 (0)89-68961 271


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>