зеркало из https://github.com/mozilla/pjs.git
Fix for bug 344362 (xsl:output omit-xml-declaration="no" does not create an XML declaration). r/sr=sicking.
This commit is contained in:
Родитель
87340ba191
Коммит
9cb69d14f0
|
@ -831,6 +831,26 @@ txMozillaXMLOutput::createResultDocument(const nsAString& aName, PRInt32 aNsID,
|
|||
doc->SetContentType(NS_LITERAL_STRING("application/xml"));
|
||||
}
|
||||
|
||||
if (mOutputFormat.mMethod == eXMLOutput &&
|
||||
mOutputFormat.mOmitXMLDeclaration != eTrue) {
|
||||
PRInt32 standalone;
|
||||
if (mOutputFormat.mStandalone == eNotSet) {
|
||||
standalone = -1;
|
||||
}
|
||||
else if (mOutputFormat.mStandalone == eFalse) {
|
||||
standalone = 0;
|
||||
}
|
||||
else {
|
||||
standalone = 1;
|
||||
}
|
||||
|
||||
// Could use mOutputFormat.mVersion.get() when we support
|
||||
// versions > 1.0.
|
||||
static const PRUnichar kOneDotZero[] = { '1', '.', '0', '\0' };
|
||||
doc->SetXMLDeclaration(kOneDotZero, mOutputFormat.mEncoding.get(),
|
||||
standalone);
|
||||
}
|
||||
|
||||
// Set up script loader of the result document.
|
||||
nsIScriptLoader *loader = doc->GetScriptLoader();
|
||||
if (loader) {
|
||||
|
|
|
@ -212,9 +212,18 @@ void txXMLOutput::startDocument()
|
|||
// XXX We should "cache" content until we have a
|
||||
// document element
|
||||
}
|
||||
*mOut << PI_START << XML_DECL << DOUBLE_QUOTE;
|
||||
*mOut << XML_VERSION;
|
||||
*mOut << DOUBLE_QUOTE << " encoding=\"UTF-8\"" << PI_END << endl;
|
||||
if (mOutputFormat.mMethod == eXMLOutput &&
|
||||
mOutputFormat.mOmitXMLDeclaration != eTrue) {
|
||||
*mOut << PI_START << XML_DECL << DOUBLE_QUOTE;
|
||||
*mOut << XML_VERSION;
|
||||
*mOut << DOUBLE_QUOTE << " encoding=\"UTF-8\"";
|
||||
if (mOutputFormat.mStandalone != eNotSet) {
|
||||
*mOut << " standalone=\"";
|
||||
*mOut << (mOutputFormat.mStandalone == eFalse ? "no" : "yes") << "\"";
|
||||
}
|
||||
*mOut << PI_END << endl;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void txXMLOutput::startElement(const nsAString& aName,
|
||||
|
|
Загрузка…
Ссылка в новой задаче