-
-
Notifications
You must be signed in to change notification settings - Fork 897
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
JRuby nokogiri incorrectly include xml declaration for html transformation #1430
Comments
Hey everyone! Just wanted to give you a heads up that I'm actively working on this issue and putting in my best effort to find a solution. |
I'm not an expert on xslt, but shouldn't the method be set by an |
To follow up on this, I think our jruby XSLT processor is incorrectly determining the default method. Here's what the standard has to say:
It's not clear to me why this is failing. The To get the output you want, I think you just need to use an input_xml = <<-EOS
<?xml version="1.0" encoding="utf-8"?>
<report>
<title>My Report</title>
</report>
EOS
input_xsl = <<-EOS
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8" />
<xsl:template match="/">
<html>
<head>
<title><xsl:value-of select="report/title"/></title>
</head>
<body>
<h1><xsl:value-of select="report/title"/></h1>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
EOS
require 'nokogiri'
xml = ::Nokogiri::XML(input_xml)
xsl = ::Nokogiri::XSLT(input_xsl)
puts xsl.apply_to(xml) The output I get is <html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>My Report</title>
</head>
<body>
<h1>My Report</h1>
</body>
</html>
|
I agree with @stevecheckoway's take that Xalan should be handling this case correctly, looking at the code for If someone could throw this into a java debugger and tell us what's going on in Xalan that would be extremely helpful. I just spent an hour trying to get jdb to work on my system and couldn't figure it out. |
Using the following code:
expected behavior:
actual behavior:
The text was updated successfully, but these errors were encountered: