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

Questions about XML that are not covered by the other forums should go here.
ari
Posts: 14
Joined: Sun Apr 01, 2012 1:17 pm

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

Post 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?
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

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

Post 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.
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
ari
Posts: 14
Joined: Sun Apr 01, 2012 1:17 pm

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

Post by ari »

thank you for the reply and the alternative solution!
Post Reply