Description
I would like to have the ability to build and xpath based on attribute values (not all, but only user-defined ordered list of key-attributes).
let's assume that user-defined key-attributes are: ["id","name"]
So for the subsection1.4.4 node generated XPath will be like
/root/page[@id='pageOne']/section[@id='section1.4']/subsection[@name='subsection1.4.4']
Explanation: id was used in pageand section nodes because it has higher priority in key-attribute settings then name, and the name attribute was used in subsection node because it does not have the id attribute.
For the last one, attributelesssubsection will be:
/root/page[@id='pageOne']/section[@id='section1.4']/subsection[5]
index 5 was used because this subsection node has none of the defined key-attributes.
I know that this makes sense only when the attributes are unique (unless the generated XPath won't point to a single node), so this attribute-base xpath-genreration feature should be either optional, or under another command.
Current Workarounds
None. Just senseless scrolling to the top to see what are the values of the current node parents attributes.
Description I would like to have the ability to build and xpath based on attribute values (not all, but only user-defined ordered list of key-attributes).
Example:
let's assume that user-defined key-attributes are:
["id","name"]
So for thesubsection1.4.4
node generated XPath will be like/root/page[@id='pageOne']/section[@id='section1.4']/subsection[@name='subsection1.4.4']
Explanation:id
was used inpage
andsection
nodes because it has higher priority in key-attribute settings thenname
, and thename
attribute was used insubsection
node because it does not have theid
attribute.For the last one, attributeless
subsection
will be:/root/page[@id='pageOne']/section[@id='section1.4']/subsection[5]
index5
was used because thissubsection
node has none of the defined key-attributes.I know that this makes sense only when the attributes are unique (unless the generated XPath won't point to a single node), so this attribute-base xpath-genreration feature should be either optional, or under another command.
Current Workarounds None. Just senseless scrolling to the top to see what are the values of the current node parents attributes.