Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XML variables are passed to XSLT without namespaces #36

Open
gioele opened this issue Nov 26, 2014 · 1 comment
Open

XML variables are passed to XSLT without namespaces #36

gioele opened this issue Nov 26, 2014 · 1 comment
Labels

Comments

@gioele
Copy link
Contributor

gioele commented Nov 26, 2014

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

<choice xml:id="abbr-cf_">
    <abbr>cf.</abbr>
    <expan>confer, compare</expan>
</choice>

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.

@gioele gioele added the bug label Nov 26, 2014
@gioele
Copy link
Contributor Author

gioele commented Dec 11, 2014

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant