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 transforms the stylesheet's (layout's) content, not the item's #399

Closed
ghost opened this issue Mar 15, 2014 · 2 comments
Closed

XSL filter transforms the stylesheet's (layout's) content, not the item's #399

ghost opened this issue Mar 15, 2014 · 2 comments

Comments

@ghost
Copy link

@ghost ghost commented Mar 15, 2014

When invoked, the XSL filter attempts to transform the stylesheet's own content using the stylesheet and not the item's. This is easy to demonstrate using a stylesheet that merely duplicates its input, i.e.

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0">
  <xsl:template match="/">
    <xsl:copy-of select="/"/>
  </xsl:template>
</xsl:stylesheet>

The result will be the stylesheet itself embedded in the output, not the item's content as you'd expect.

The problem is in Nanoc::Filter::XSL.run, which uses the value of the content parameter passed to it as the content to transform. But when invoked as a layout, and the XSL filter is only ever invoked as a layout, this parameter contains the layout's content and not the item's. The item's content is available as assigns[:content] instead.

I've fixed this problem and updated the test cases locally and will be submitting a pull request shortly.

ddfreyne added a commit that referenced this issue Mar 15, 2014
…tem-content

Make XSL filter transform the item, not the layout - issue #399
@ddfreyne
Copy link
Member

@ddfreyne ddfreyne commented Mar 15, 2014

Fixed. Thanks!

It’s also in the release notes now: d7e25fd

@ghost
Copy link
Author

@ghost ghost commented Mar 15, 2014

Great, thank you!

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

Successfully merging a pull request may close this issue.

None yet
1 participant