xsl-list
[Top] [All Lists]

[xsl] Complex XPath question

2013-03-01 16:38:50
I have the following XML:

<wrapper>
<object class="Page" package="com.atlassian.confluence.pages">
        <id name="id">37716253</id>
        <property name="title">
                <![CDATA[COMPARE]]>
        </property>
        ...
        <property name="version">3</property>
        <property name="creatorName">
                <![CDATA[wbenica]]>
        </property>
        <property name="creationDate">2012-11-16 14:00:35.000</property>
</object>
<object class="Page" package="com.atlassian.confluence.pages">
        <id name="id">37716529</id>
        <property name="title">
                <![CDATA[COMPARE]]>
        </property>
        ...
        <property name="version">1</property>
        <property name="creatorName">
                <![CDATA[wbenica]]>
        </property>
        <property name="creationDate">2012-11-16 14:00:35.000</property>
</object>
<object class="Page" package="com.atlassian.confluence.pages">
        <id name="id">37716528</id>
        <property name="title">
                <![CDATA[COMPARE]]>
        </property>
        ...
        <property name="version">2</property>
        <property name="creatorName">
                <![CDATA[wbenica]]>
        </property>
</object>
<object class="Page" package="com.atlassian.confluence.pages">
        <id name="id">37716253</id>
        <property name="title">
                <![CDATA[SOME OTHER TITLE]]>
        </property>
        ...
        <property name="version">3</property>
        <property name="creatorName">
                <![CDATA[wbenica]]>
        </property>
        <property name="creationDate">2012-11-16 14:00:35.000</property>
</object>
</wrapper>

I want to find the <id> element value for the <object> element that has
the highest version <property> (of those matching the title) and matches the
title <property> element for 'COMPARE'.

The following matchs all <object>
elements that have a title and version:

//object[property[@name='title'] and property[@name='version']]

How do I look for a specific title and find the highest version? Is it
possible in one XPath statement?




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


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