- Package:
- libxslt1.1
- Source:
- libxslt
- Description:
- XSLT 1.0 processing library - runtime library
- Submitter:
- "brian m. carlson"
- Date:
- 2010-07-23 09:15:08 UTC
- Severity:
- minor
When using the output method xml (whether implicitly or explicitly), libxslt1.1 outputs an XML declaration. However, it does not include an encoding pseudo-attribute. Obviously, libxslt1.1 knows what encoding it used to output the data (hopefully UTF-8) and it should be explicit about that. The XSLT spec says: The xml output method should output an XML declaration unless the omit-xml-declaration attribute has the value yes. The XML declaration should include both version information and an encoding declaration. Please be sure that when emitting an encoding declaration that you use the upper-case form of "UTF-8" (see #568347). I have not included a testcase because this behavior is trivially reproducible with xsltproc.
tags 589875 patch kthxbye This patch causes libxslt1.1 to output an encoding declaration whenever it outputs an XML declaration. It also has the side effect of applying to the html and text output methods. This should not be a problem; the text method specifies that the default encoding is system-dependent, and UTF-8 is a fine default for that. If you'd like a patch that only applies to the xml output method, I can do that.
And the XML spec says in substance that if the encoding is UTF-8 or UTF-16, you don't need an encoding declaration. Is there a hidden problem you're not mentioning and you are trying to solve? Mike
I understand this. That's why it's a should, not a must. It's just making it more explicit. Not really. The only perk is that it makes text (that is, XML-unaware) comparisons work a little better when comparing them with the output of Xalan (and Saxon), which I often do to test my stylesheet code. If you decide that you don't want to implement this, that's okay. I figured it was an improvement overall with no real downsides and something that it would take me all of fifteen minutes to fix, so I did it.
I'm not really intested in diverging from upstream for such matters, and I'm not really convinced upstream would take it for the same reason I wouldn't. But please feel free to make your case on xslt@gnome.org. Cheers, Mike