You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@apache.org on 2004/11/06 02:28:07 UTC
cvs commit: xml-xalan/c/src/xalanc/XSLT StylesheetRoot.cpp StylesheetRoot.hpp XSLTEngineImpl.cpp
dbertoni 2004/11/05 17:28:07
Modified: c/src/xalanc/XSLT StylesheetRoot.cpp StylesheetRoot.hpp
XSLTEngineImpl.cpp
Log:
Make sure implicit indenting works when switching to HTML output dynamically.
Revision Changes Path
1.23 +2 -2 xml-xalan/c/src/xalanc/XSLT/StylesheetRoot.cpp
Index: StylesheetRoot.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/StylesheetRoot.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- StylesheetRoot.cpp 5 Nov 2004 23:42:33 -0000 1.22
+++ StylesheetRoot.cpp 6 Nov 2004 01:28:07 -0000 1.23
@@ -579,9 +579,9 @@
}
}
+ // If HTML output
if(m_outputMethod == FormatterListener::OUTPUT_METHOD_HTML &&
- m_indentResult != eIndentNoExplicit &&
- m_indentResult != eIndentYesExplicit)
+ m_indentResult == eIndentNoImplicit)
{
m_indentResult = eIndentYesImplicit;
}
1.14 +14 -0 xml-xalan/c/src/xalanc/XSLT/StylesheetRoot.hpp
Index: StylesheetRoot.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/StylesheetRoot.hpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- StylesheetRoot.hpp 5 Nov 2004 23:42:33 -0000 1.13
+++ StylesheetRoot.hpp 6 Nov 2004 01:28:07 -0000 1.14
@@ -159,6 +159,20 @@
}
/**
+ * Determine if output indenting should be
+ * enabled for HTML output. Semantically,
+ * this implies the output method is implicit,
+ * not explicit, but we don't really check that.
+ *
+ * @return true to indent
+ */
+ bool
+ getHTMLOutputIndent() const
+ {
+ return m_indentResult == eIndentNoExplicit ? false : true;
+ }
+
+ /**
* Get the output encoding string that was specified in the
* xsl:output element
*
1.19 +22 -15 xml-xalan/c/src/xalanc/XSLT/XSLTEngineImpl.cpp
Index: XSLTEngineImpl.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/XSLTEngineImpl.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- XSLTEngineImpl.cpp 5 Nov 2004 20:05:02 -0000 1.18
+++ XSLTEngineImpl.cpp 6 Nov 2004 01:28:07 -0000 1.19
@@ -1517,10 +1517,11 @@
const unsigned int n = thePendingAttributes.getLength();
- for(unsigned int i = 0; i < n; i++)
+ for(unsigned int i = 0; i < n; ++i)
{
- if(equals(thePendingAttributes.getName(i),
- DOMServices::s_XMLNamespace) == true)
+ if(equals(
+ thePendingAttributes.getName(i),
+ DOMServices::s_XMLNamespace) == true)
{
return true;
}
@@ -1541,17 +1542,20 @@
if (m_stylesheetRoot->isOutputMethodSet() == false)
{
- if (equalsIgnoreCaseASCII(getPendingElementName(),
- Constants::ELEMNAME_HTML_STRING) == true &&
+ if (equalsIgnoreCaseASCII(
+ getPendingElementName(),
+ Constants::ELEMNAME_HTML_STRING) == true &&
pendingAttributesHasDefaultNS() == false)
{
- if (getFormatterListenerImpl()->getOutputFormat() == FormatterListener::OUTPUT_METHOD_XML)
- {
- // Yuck!!! Ugly hack to switch to HTML on-the-fly.
- FormatterListener* const theFormatter =
+ FormatterListener* const theFormatter =
getFormatterListenerImpl();
- assert(theFormatter->getWriter() != 0);
+ assert(
+ theFormatter != 0 &&
+ theFormatter->getWriter() != 0);
+ if (theFormatter->getOutputFormat() == FormatterListener::OUTPUT_METHOD_XML)
+ {
+ // Yuck!!! Ugly hack to switch to HTML on-the-fly.
setFormatterListenerImpl(
m_executionContext->createFormatterToHTML(
*theFormatter->getWriter(),
@@ -1559,9 +1563,10 @@
theFormatter->getMediaType(),
theFormatter->getDoctypeSystem(),
theFormatter->getDoctypePublic(),
- m_stylesheetRoot->getOutputIndent(),
- theFormatter->getIndent() > 0 ? theFormatter->getIndent() :
- StylesheetExecutionContext::eDefaultHTMLIndentAmount));
+ m_stylesheetRoot->getHTMLOutputIndent(),
+ theFormatter->getIndent() > 0 ?
+ theFormatter->getIndent() :
+ StylesheetExecutionContext::eDefaultHTMLIndentAmount));
if (m_hasCDATASectionElements == true)
{
@@ -1572,14 +1577,16 @@
}
}
- if(getHasPendingStartDocument() == true && getMustFlushPendingStartDocument() == true)
+ if(getHasPendingStartDocument() == true &&
+ getMustFlushPendingStartDocument() == true)
{
startDocument();
}
XalanDOMString& thePendingElementName = getPendingElementNameImpl();
- if(0 != length(thePendingElementName) && getMustFlushPendingStartDocument() == true)
+ if(0 != length(thePendingElementName) &&
+ getMustFlushPendingStartDocument() == true)
{
assert(getFormatterListenerImpl() != 0);
assert(m_executionContext != 0);
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org