xml - Select elements with unique values -


i'm trying parse openoffice spreadsheet obtain rows unique values in first column.

i.e., retrieve following xml fragment <table:table-row> elements unique <text:p> values in first child <table:table-cell>.

    <table:table table:name="foo">         <table:table-row>             <table:table-cell>                 <text:p>1</text:p>             </table:table-cell>             <table:table-cell>                 <text:p>foo</text:p>             </table:table-cell>         </table:table-row>         <table:table-row>             <table:table-cell>                 <text:p>2</text:p>             </table:table-cell>             <table:table-cell>                 <text:p>bar</text:p>             </table:table-cell>         </table:table-row>         <table:table-row>             <table:table-cell>                 <text:p>1</text:p>             </table:table-cell>             <table:table-cell>                 <text:p>baz</text:p>             </table:table-cell>         </table:table-row>     </table:table> 

i'll below output nodes

        <table:table-row>             <table:table-cell>                 <text:p>1</text:p>             </table:table-cell>             <table:table-cell>                 <text:p>foo</text:p>             </table:table-cell>         </table:table-row>         <table:table-row>             <table:table-cell>                 <text:p>2</text:p>             </table:table-cell>             <table:table-cell>                 <text:p>bar</text:p>             </table:table-cell>         </table:table-row> 

how can xpath?

this xpath produces desired output: /table:table/table:table-row[not(./table:table-cell[1]/text:p/text() = preceding-sibling::table:table-row/table:table-cell[1]/text:p/text())]


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -