Given an input document that looks like:

<input>
<modify class-name="NIU_HR_EDIR" event-id="PSDEVL+304334" src-
dn="99999999">
<association>NIU_HR_EDIR/99999999</association>

<modify-attr attr-name="NIU_EMC_PHONE_V">
<add-value>
<value>
<component name="EMC_CONTACT_NAME">EM Name 1</component>
<component name="EMC_PHONE_TYPE">CELL</component>
<component name="EMC_PHONE">815/588-2300</component>
</value>
</add-value>
<add-value>
<value>
<component name="EMC_CONTACT_NAME">EM Name 2</component>
<component name="EMC_PHONE_TYPE">CELL</component>
<component name="EMC_PHONE">815/867-5309</component>
</value>
</add-value>
<add-value>
<value>
<component name="EMC_CONTACT_NAME">EM Name 2</component>
<component name="EMC_PHONE_TYPE">OTR</component>
<component name="EMC_PHONE">815/753-1000</component>
</value>
</add-value>
</modify-attr>
<modify-attr attr-name="NIU_EMC_EMAIL_V">
<add-value>
<value>
<component name="EMC_CONTACT_NAME">EM Name 1</component>
<component name="EMC_E_ADDR_TYPE">HOME</component>
<component name="EMC_EMAIL_ADDR">testem1@nowhere.com</component>
</value>
</add-value>
<add-value>
<value>
<component name="EMC_CONTACT_NAME">EM Name 2</component>
<component name="EMC_E_ADDR_TYPE">HOME</component>
<component name="EMC_EMAIL_ADDR">testem2@nowhere.com</component>
</value>
</add-value>
</modify-attr>

</modify>
</input>

where there are an arbitrary number of contacts, and an arbitrary number
of different phone numbers, each with a different EMC_PHONE_TYPE, take
the first two contacts (by name, so "EM Name 1" is the first, "EM Name 2"
is the second, and any others that are present in the document can be
ignored) and assign eDirectory attributes:

emergency contact email address 1 == testem1@nowhere.com
emergency contact email address 2 == testem2@nowhere.com
emergency contact home phone 1 == cleared
emergency contact home phone 2 == cleared
emergency contact mobile phone 1 == 815/588-2300
emergency contact mobile phone 2 == 815/867-5309

EMC_PHONE_TYPE = HOME should be mapped to the "emergency contact home
phone". Missing data, in this case, is to be turned in to a do-clear-dest-
attr-value.

Further, you can trust the positional order of the contacts, so that the
first one in the document is the "first" contact, the second one in the
document is the "second" contact, and any others can be ignored, in all
cases.

I have this solved and working. I'll post my solution shortly. I'll be
honest, though, it took me a couple of hours to get the XPath syntax for
this figured out. The challenge here is to see if you can do it faster,
or better.


--
--------------------------------------------------------------------------
David Gersic dgersic_@_niu.edu
Knowledge Partner http://forums.netiq.com

Please post questions in the forums. No support provided via email.