Open gioele opened 9 years ago
An answer to sparklemotion/nokogiri#1200 suggests using doc << v.clone
instead of doc << v
in the part of the XML serializator that deals with XML nodes.
if v.respond_to?(:to_xml)
begin
- doc << v.to_xml(:skip_instruct => true).to_s
+ doc << v.clone.to_xml(:skip_instruct => true).to_s
rescue ArgumentError
# Some to_xml methods don't understand skip_instruct
- doc << v.to_xml.to_s
+ doc << v.clone.to_xml.to_s
end
elsif v.respond_to?(:to_s)
When the XSLT-view code compiles the source XML to be passed to the XSLT engine, it embeds the eventual XML nodes presents in values without all the needed XML namespaces.
For example, the following node
cannot be embedded as it is because it lacks the necessary TEI namespace.
This bug is a combination of various factors, first of all to a bug in nokogiri where it does not copy over all the needed namespaces: sparklemotion/nokogiri#1200. A question on how to work around this problem has been filed on StackOverflow: Serialize XML node as document with correct namespaces.