Hi,
I'm exploring the power of XPATH in policies but now I got stuck in one
situation. I need to find one group which has the oldest attribute. Here
is my situation. I have a nodeset stored in the local variable bStudies.
It looks like this:
<instance class-name="Group"
qualified-src-dn="C=CZ\O=JCU\OU=STUDIUM\CN=S-T01104"
src-dn="\JCU-TREZOR\CZ\JCU\STUDIUM\S-T01104" src-entry-id="66469">
<association state="pending"></association>
<attr attr-name="claKodStudia">
<value timestamp="1196094876#57" type="string">B6107</value>
</attr>
<attr attr-name="OU">
<value timestamp="1196094876#50" type="string">FTE</value>
</attr>
<attr attr-name="claDatumNastupu">
<value timestamp="1247559693#2" type="time">904687200</value>
</attr>
</instance>
<instance class-name="Group"
qualified-src-dn="C=CZ\O=JCU\OU=STUDIUM\CN=S-T01103"
src-dn="\JCU-TREZOR\CZ\JCU\STUDIUM\S-T01103" src-entry-id="66468">
<association state="pending"></association>
<attr attr-name="claKodStudia">
<value timestamp="1196094876#12" type="string">B6107</value>
</attr>
<attr attr-name="OU">
<value timestamp="1247559854#2" type="string">FFI</value>
</attr>
<attr attr-name="claDatumNastupu">
<value timestamp="1247559656#2" type="time">1000591200</value>
</attr>
</instance>
<instance class-name="Group"
qualified-src-dn="C=CZ\O=JCU\OU=STUDIUM\CN=S-T01102"
src-dn="\JCU-TREZOR\CZ\JCU\STUDIUM\S-T01102" src-entry-id="66467">
<association state="pending"></association>
<attr attr-name="claKodStudia">
<value timestamp="1196094875#57" type="string">B6107</value>
</attr>
<attr attr-name="OU">
<value timestamp="1247559841#2" type="string">FEK</value>
</attr>
<attr attr-name="claDatumNastupu">
<value timestamp="1196094875#53" type="time">999640800</value>
</attr>
</instance>

What I need is to find the group whose attribute "claDatumNastupu" has
the minimum value i.e. the oldest one and then read its OU attribute. I
found some examples on this but it looks that I misunderstood them or
I'm just not so good at creating XPATH expressions.
I just created this by myself, but it doesn't work at all:
XPATH("$bStudies[attr[@attr-name='claDatumNastupu']/value[not(. >
preceding-sibling::value or . >
following-sibling::value)][1]]/attr[@attr-name='OU']")

Any help would be appreciated.


--
hrobarik
------------------------------------------------------------------------
hrobarik's Profile: http://forums.novell.com/member.php?userid=24050
View this thread: http://forums.novell.com/showthread.php?t=379965