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
simonsouth opened this Issue Mar 17, 2014 · 5 comments

Comments

Projects
None yet
3 participants
@simonsouth
Contributor

simonsouth 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.

@simonsouth

This comment has been minimized.

Show comment
Hide comment
@simonsouth

simonsouth Mar 17, 2014

Contributor

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

Contributor

simonsouth commented Mar 17, 2014

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

@ddfreyne

This comment has been minimized.

Show comment
Hide comment
@ddfreyne

ddfreyne Mar 17, 2014

Member

👍

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

Member

ddfreyne commented Mar 17, 2014

👍

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

@simonsouth

This comment has been minimized.

Show comment
Hide comment
@simonsouth

simonsouth Mar 17, 2014

Contributor

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).

Contributor

simonsouth 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

This comment has been minimized.

Show comment
Hide comment
@osg

osg Mar 17, 2014

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

osg commented Mar 17, 2014

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

ddfreyne added a commit that referenced this issue Mar 22, 2014

Merge pull request #404 from simonsouth/bug/make-xsl-filter-honor-omi…
…t-xml-declaration

Honor "omit-xml-declaration" in XSL stylesheets - issue #403
@ddfreyne

This comment has been minimized.

Show comment
Hide comment
@ddfreyne

ddfreyne Mar 22, 2014

Member

Fixed by #404.

Member

ddfreyne commented Mar 22, 2014

Fixed by #404.

@ddfreyne ddfreyne closed this Mar 22, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment