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

XSL filter ignores "omit-xml-declaration" setting in stylesheets #403

Closed
ghost opened this issue Mar 17, 2014 · 5 comments
Closed

XSL filter ignores "omit-xml-declaration" setting in stylesheets #403

ghost opened this issue Mar 17, 2014 · 5 comments

Comments

@ghost
Copy link

ghost commented Mar 17, 2014

Specifying omit-xml-declaration="yes" in an XSL stylesheet is supposed to suppress the XML declaration (<?xml ...?>) at the top of the generated output. However, nanoc's XSL filter ignores this setting, which causes problems when the filter is used to generate XML fragments for inclusion in other layouts.

The problem is the filter invokes Nokogiri in a way that returns an object representing the transformed XML. When the filter requests a string representation from the object a new XML declaration is naturally generated.

The solution is to change the filter so it fetches the raw output of the transformation, which will make omitted elements stay omitted.

This is another small fix I've made locally and I'll submit a pull request in a moment.

@ghost
Copy link
Author

ghost commented Mar 17, 2014

Or rather, I will when GitHub starts cooperating with me.

@denisdefreyne
Copy link
Member

👍

(Out of curiosity, what are you using the XSL stylesheets for?)

@ghost
Copy link
Author

ghost commented Mar 17, 2014

Documentation for a REST API. I'm capturing descriptions of the resources in a simple, custom XML format that is transformed into DocBook reference entries and then into XHTML (and possibly, someday, into XSL-FO and PDF).

@osg
Copy link

osg commented Mar 17, 2014

@simonsouth If the content is open or sanitized, I would love to see it.

denisdefreyne added a commit that referenced this issue Mar 22, 2014
…t-xml-declaration

Honor "omit-xml-declaration" in XSL stylesheets - issue #403
@denisdefreyne
Copy link
Member

Fixed by #404.

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

No branches or pull requests

2 participants