So if I have xml that looks like the below and I am in the node “FULLTIME” how can I tell that I am in EMPLOYEE as opposed to contractor? So is there a function I can use that will return something like “ROOT/PERSON/EMPLOYEE” showing me that from the FULLTIME Node the parent nodes are ROOT, PERSON, and EMPLOYEE? I can’t seem to find anything that will provide that. I am new to xslt so my ignorance is probably a big part of me not being able to find what I want.
<ROOT>
<PERSON>
<EMPLOYEE>
<FULLTIME>
<NAME>Mike</NAME>
<LAST_NAME>Thompson</LAST_NAME>
<EMPLOYEE_ID>1</EMPLOYEE_ID>
</FULLTIME>
<PARTTIME />
</EMPLOYEE>
<CONTRACTOR>
<FULLTIME>
<NAME>Mike</NAME>
<LAST_NAME>Olsen</LAST_NAME>
<EMPLOYEE_ID>2</EMPLOYEE_ID>
</FULLTIME>
<PARTTIME />
</CONTRACTOR>
</PERSON>
</ROOT>
Any suggestions would be greatly appreciated!
–S
The
ancestoraxis can be used to ‘look up’ through the tree. It’s not entirely clear what you want to do, but you can test if EMPLOYEE is your ancestor: