Page 1 of 1

XML Refactoring: unwrap all spans with just a @lang attribute

Posted: Fri Mar 17, 2023 6:37 pm
by ari
I'm trying to unwrap all spans that just have an @lang attribute
in the XPath builder I'm using the following expression which works
`//span[@lang and count(@*) = 1]`

but when I try to use the same expression using XML Refactoring I get a "No resources were affected" message?

am I missing something?

Re: XML Refactoring: unwrap all spans with just a @lang attribute

Posted: Fri Mar 17, 2023 7:48 pm
by Radu
Hi,

The XML refactoring used by Oxygen uses some invisible attribute (attributes which are not serialized to the XML content) on each element in order to keep track of various information. So the Xpath selector "not(@*)" will never be true.

Maybe you can try this more complex xpath expression which skips over our "oxy_" specific attributes when counting:

Code: Select all

count(@* except @*[starts-with(local-name(), 'oxy_')])
We already have an internal issue to see what we can do about this on our side to try and make your original xpath expression work.

Re: XML Refactoring: unwrap all spans with just a @lang attribute

Posted: Sat Mar 18, 2023 9:53 pm
by ari
thank you for the reply and the alternative solution!