![](https://secure.gravatar.com/avatar/114f07f31e228d83eece631b0937df73.jpg?s=120&d=mm&r=g)
Hello list, is there a Lua function to get the XML path of an element as a string?
Found. I adapted a function from lxml-tex.lua (chainpath): function xmlpath( e, nonamespace ) if e then local t = { } while e do local tg = e.tg local rt = e.__p__ local ns = e.ns if tg == "@rt@" then break elseif rt.tg == "@rt@" then if nonamespace or not ns or ns == "" then t[ #t + 1 ] = tg else t[ #t + 1 ] = ns .. ":" .. tg end else if nonamespace or not ns or ns == "" then t[ #t + 1 ] = tg .. "[" .. e.ei .. "]" else t[ #t + 1 ] = ns .. ":" .. tg .. "[" .. e.ei .. "]" end end e = rt end return table.concat( table.reverse( t ), "/" ) else return "" end end