When using the find replace transform with an XPath that includes predicates it fails to locate the proper element because the referenced tag in the predicate is not namespaced.
This test in test_transforms.py passes because the test XML included is not namespaced however it fails if it were re-written as the following (note the added xmlns to bookstore):
The transformed xpath ends up looking like /*[local-name()="bookstore"]/*[local-name()="book"][price>40]/*[local-name()="author"][2]
note how price here does not reference local-name.
I think something that could work here is instead of parsing the xpath to add local-name references, storing predicates and re-adding them, the process can be simplified significantly (and made a bit more robust) by simply removing the xmlns declaration and then adding it back at the end.
Describe the bug
When using the find replace transform with an XPath that includes predicates it fails to locate the proper element because the referenced tag in the predicate is not namespaced.
This test in test_transforms.py passes because the test XML included is not namespaced however it fails if it were re-written as the following (note the added xmlns to bookstore):
The transformed xpath ends up looking like
/*[local-name()="bookstore"]/*[local-name()="book"][price>40]/*[local-name()="author"][2]
note how price here does not reference local-name.
I think something that could work here is instead of parsing the xpath to add local-name references, storing predicates and re-adding them, the process can be simplified significantly (and made a bit more robust) by simply removing the xmlns declaration and then adding it back at the end.
Reproduction steps
Your CumulusCI and Python versions
CumulusCI version: 3.85.0 Python version: 3.11.7
Operating System
Mac OSX 14.4
Windows environment
No response
CumulusCI installation method
None
Error Gist
No response
Additional information
No response