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 2002/08/13 07:37:07 UTC
cvs commit: xml-xalan/c/src/XSLT Constants.cpp Constants.hpp StylesheetExecutionContext.hpp StylesheetExecutionContextDefault.cpp StylesheetExecutionContextDefault.hpp StylesheetRoot.cpp StylesheetRoot.hpp
dbertoni 2002/08/12 22:37:07
Modified: c/src/XSLT Constants.cpp Constants.hpp
StylesheetExecutionContext.hpp
StylesheetExecutionContextDefault.cpp
StylesheetExecutionContextDefault.hpp
StylesheetRoot.cpp StylesheetRoot.hpp
Log:
Implemented new options for output. Includes both extensions for xsl:output and programmatic interfaces.
Revision Changes Path
1.19 +13 -1 xml-xalan/c/src/XSLT/Constants.cpp
Index: Constants.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/Constants.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- Constants.cpp 4 Apr 2002 06:20:43 -0000 1.18
+++ Constants.cpp 13 Aug 2002 05:37:06 -0000 1.19
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -92,6 +92,7 @@
static XalanDOMString ATTRNAME_EXCLUDE_RESULT_PREFIXES;
static XalanDOMString ATTRNAME_EXPR;
static XalanDOMString ATTRNAME_EXTENSIONELEMENTPREFIXES;
+static XalanDOMString ATTRNAME_ESCAPE_URLS;
static XalanDOMString ATTRNAME_FORMAT;
static XalanDOMString ATTRNAME_FROM;
static XalanDOMString ATTRNAME_FUNCTIONS;
@@ -100,6 +101,7 @@
static XalanDOMString ATTRNAME_HREF;
static XalanDOMString ATTRNAME_ID;
static XalanDOMString ATTRNAME_IMPORTANCE;
+static XalanDOMString ATTRNAME_INDENTAMOUNT;
static XalanDOMString ATTRNAME_INDENTRESULT;
static XalanDOMString ATTRNAME_INFINITY;
static XalanDOMString ATTRNAME_LANG;
@@ -114,6 +116,7 @@
static XalanDOMString ATTRNAME_NAN;
static XalanDOMString ATTRNAME_NDIGITSPERGROUP;
static XalanDOMString ATTRNAME_NS;
+static XalanDOMString ATTRNAME_OMIT_META_TAG;
static XalanDOMString ATTRNAME_ONLY;
static XalanDOMString ATTRNAME_ORDER;
static XalanDOMString ATTRNAME_OUTPUT_CDATA_SECTION_ELEMENTS;
@@ -301,6 +304,7 @@
const XalanDOMString& Constants::ATTRNAME_DISABLE_OUTPUT_ESCAPING = ::ATTRNAME_DISABLE_OUTPUT_ESCAPING;
const XalanDOMString& Constants::ATTRNAME_ELEMENT = ::ATTRNAME_ELEMENT;
const XalanDOMString& Constants::ATTRNAME_ELEMENTS = ::ATTRNAME_ELEMENTS;
+const XalanDOMString& Constants::ATTRNAME_ESCAPE_URLS = ::ATTRNAME_ESCAPE_URLS;
const XalanDOMString& Constants::ATTRNAME_EXCLUDE_RESULT_PREFIXES = ::ATTRNAME_EXCLUDE_RESULT_PREFIXES;
const XalanDOMString& Constants::ATTRNAME_EXPR = ::ATTRNAME_EXPR;
const XalanDOMString& Constants::ATTRNAME_EXTENSIONELEMENTPREFIXES = ::ATTRNAME_EXTENSIONELEMENTPREFIXES;
@@ -312,6 +316,7 @@
const XalanDOMString& Constants::ATTRNAME_HREF = ::ATTRNAME_HREF;
const XalanDOMString& Constants::ATTRNAME_ID = ::ATTRNAME_ID;
const XalanDOMString& Constants::ATTRNAME_IMPORTANCE = ::ATTRNAME_IMPORTANCE;
+const XalanDOMString& Constants::ATTRNAME_INDENTAMOUNT = ::ATTRNAME_INDENTAMOUNT;
const XalanDOMString& Constants::ATTRNAME_INDENTRESULT = ::ATTRNAME_INDENTRESULT;
const XalanDOMString& Constants::ATTRNAME_INFINITY = ::ATTRNAME_INFINITY;
const XalanDOMString& Constants::ATTRNAME_LANG = ::ATTRNAME_LANG;
@@ -326,6 +331,7 @@
const XalanDOMString& Constants::ATTRNAME_NAN = ::ATTRNAME_NAN;
const XalanDOMString& Constants::ATTRNAME_NDIGITSPERGROUP = ::ATTRNAME_NDIGITSPERGROUP;
const XalanDOMString& Constants::ATTRNAME_NS = ::ATTRNAME_NS;
+const XalanDOMString& Constants::ATTRNAME_OMIT_META_TAG = ::ATTRNAME_OMIT_META_TAG;
const XalanDOMString& Constants::ATTRNAME_ONLY = ::ATTRNAME_ONLY;
const XalanDOMString& Constants::ATTRNAME_ORDER = ::ATTRNAME_ORDER;
const XalanDOMString& Constants::ATTRNAME_OUTPUT_CDATA_SECTION_ELEMENTS = ::ATTRNAME_OUTPUT_CDATA_SECTION_ELEMENTS;
@@ -515,6 +521,7 @@
::ATTRNAME_DISABLE_OUTPUT_ESCAPING = XALAN_STATIC_UCODE_STRING("disable-output-escaping");
::ATTRNAME_ELEMENT = XALAN_STATIC_UCODE_STRING("element");
::ATTRNAME_ELEMENTS = XALAN_STATIC_UCODE_STRING("elements");
+ ::ATTRNAME_ESCAPE_URLS = XALAN_STATIC_UCODE_STRING("use-url-escaping");
::ATTRNAME_EXCLUDE_RESULT_PREFIXES = XALAN_STATIC_UCODE_STRING("exclude-result-prefixes");
::ATTRNAME_EXPR = XALAN_STATIC_UCODE_STRING("expr");
::ATTRNAME_EXTENSIONELEMENTPREFIXES = XALAN_STATIC_UCODE_STRING("extension-element-prefixes");
@@ -526,6 +533,7 @@
::ATTRNAME_HREF = XALAN_STATIC_UCODE_STRING("href");
::ATTRNAME_ID = XALAN_STATIC_UCODE_STRING("id");
::ATTRNAME_IMPORTANCE = XALAN_STATIC_UCODE_STRING("importance");
+ ::ATTRNAME_INDENTAMOUNT = XALAN_STATIC_UCODE_STRING("indent-amount");
::ATTRNAME_INDENTRESULT = XALAN_STATIC_UCODE_STRING("indent-result");
::ATTRNAME_INFINITY = XALAN_STATIC_UCODE_STRING("infinity");
::ATTRNAME_LANG = XALAN_STATIC_UCODE_STRING("lang");
@@ -540,6 +548,7 @@
::ATTRNAME_NAN = XALAN_STATIC_UCODE_STRING("NaN");
::ATTRNAME_NDIGITSPERGROUP = XALAN_STATIC_UCODE_STRING("n-digits-per-group");
::ATTRNAME_NS = XALAN_STATIC_UCODE_STRING("ns");
+ ::ATTRNAME_OMIT_META_TAG = XALAN_STATIC_UCODE_STRING("omit-meta-tag");
::ATTRNAME_ONLY = XALAN_STATIC_UCODE_STRING("only");
::ATTRNAME_ORDER = XALAN_STATIC_UCODE_STRING("order");
::ATTRNAME_OUTPUT_CDATA_SECTION_ELEMENTS = XALAN_STATIC_UCODE_STRING("cdata-section-elements");
@@ -730,6 +739,7 @@
releaseMemory(::ATTRNAME_DISABLE_OUTPUT_ESCAPING);
releaseMemory(::ATTRNAME_ELEMENT);
releaseMemory(::ATTRNAME_ELEMENTS);
+ releaseMemory(::ATTRNAME_ESCAPE_URLS);
releaseMemory(::ATTRNAME_EXCLUDE_RESULT_PREFIXES);
releaseMemory(::ATTRNAME_EXPR);
releaseMemory(::ATTRNAME_EXTENSIONELEMENTPREFIXES);
@@ -741,6 +751,7 @@
releaseMemory(::ATTRNAME_HREF);
releaseMemory(::ATTRNAME_ID);
releaseMemory(::ATTRNAME_IMPORTANCE);
+ releaseMemory(::ATTRNAME_INDENTAMOUNT);
releaseMemory(::ATTRNAME_INDENTRESULT);
releaseMemory(::ATTRNAME_INFINITY);
releaseMemory(::ATTRNAME_LANG);
@@ -755,6 +766,7 @@
releaseMemory(::ATTRNAME_NAN);
releaseMemory(::ATTRNAME_NDIGITSPERGROUP);
releaseMemory(::ATTRNAME_NS);
+ releaseMemory(::ATTRNAME_OMIT_META_TAG);
releaseMemory(::ATTRNAME_ONLY);
releaseMemory(::ATTRNAME_ORDER);
releaseMemory(::ATTRNAME_OUTPUT_CDATA_SECTION_ELEMENTS);
1.16 +4 -1 xml-xalan/c/src/XSLT/Constants.hpp
Index: Constants.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/Constants.hpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- Constants.hpp 26 Nov 2001 23:17:23 -0000 1.15
+++ Constants.hpp 13 Aug 2002 05:37:06 -0000 1.16
@@ -278,6 +278,7 @@
static const XalanDOMString& ATTRNAME_DIGITGROUPSEP;
static const XalanDOMString& ATTRNAME_ELEMENT;
static const XalanDOMString& ATTRNAME_ELEMENTS;
+ static const XalanDOMString& ATTRNAME_ESCAPE_URLS;
static const XalanDOMString& ATTRNAME_EXCLUDE_RESULT_PREFIXES;
static const XalanDOMString& ATTRNAME_EXPR;
static const XalanDOMString& ATTRNAME_EXTENSIONELEMENTPREFIXES;
@@ -289,6 +290,7 @@
static const XalanDOMString& ATTRNAME_HREF;
static const XalanDOMString& ATTRNAME_ID;
static const XalanDOMString& ATTRNAME_IMPORTANCE;
+ static const XalanDOMString& ATTRNAME_INDENTAMOUNT;
static const XalanDOMString& ATTRNAME_INDENTRESULT;
static const XalanDOMString& ATTRNAME_INFINITY;
static const XalanDOMString& ATTRNAME_LANG;
@@ -301,6 +303,7 @@
static const XalanDOMString& ATTRNAME_NAMESPACE;
static const XalanDOMString& ATTRNAME_NAN;
static const XalanDOMString& ATTRNAME_NDIGITSPERGROUP;
+ static const XalanDOMString& ATTRNAME_OMIT_META_TAG;
static const XalanDOMString& ATTRNAME_ONLY;
static const XalanDOMString& ATTRNAME_ORDER;
static const XalanDOMString& ATTRNAME_PATTERNSEPARATOR;
@@ -316,6 +319,7 @@
static const XalanDOMString& ATTRNAME_SEQUENCESRC;
static const XalanDOMString& ATTRNAME_SRC;
static const XalanDOMString& ATTRNAME_STYLE;
+ static const XalanDOMString& ATTRNAME_STYLESHEET_PREFIX;
static const XalanDOMString& ATTRNAME_TERMINATE;
static const XalanDOMString& ATTRNAME_TEST;
static const XalanDOMString& ATTRNAME_TOSTRING;
@@ -328,7 +332,6 @@
static const XalanDOMString& ATTRNAME_XMLNSDEF;
static const XalanDOMString& ATTRNAME_XMLSPACE;
static const XalanDOMString& ATTRNAME_ZERODIGIT;
- static const XalanDOMString& ATTRNAME_STYLESHEET_PREFIX;
// Atributes on the functions element
static const XalanDOMString& ATTRNAME_NS;
1.76 +66 -9 xml-xalan/c/src/XSLT/StylesheetExecutionContext.hpp
Index: StylesheetExecutionContext.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContext.hpp,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -r1.75 -r1.76
--- StylesheetExecutionContext.hpp 10 Jul 2002 00:43:01 -0000 1.75
+++ StylesheetExecutionContext.hpp 13 Aug 2002 05:37:06 -0000 1.76
@@ -1214,10 +1214,71 @@
enum eDummy
{
eDefaultXMLIndentAmount = 0,
- eDefaultHTMLIndentAmount = 0
+ eDefaultHTMLIndentAmount = 0,
};
/**
+ * Enums to determine whether or not run-time escaping of URLs has been set.
+ */
+ enum eEscapeURLs
+ {
+ eEscapeURLsDefault, // Use the value in the stylesheet
+ eEscapeURLsNo, // Don't escape URLs
+ eEscapeURLsYes // Escape URLs
+ };
+
+ /**
+ * Get the value for run-time escaping of URLs. This can
+ * override the property specified by the stylesheet. The
+ * default behavior is to honor the property in the stylesheet.
+ *
+ * @return The value of the enum
+ */
+ virtual eEscapeURLs
+ getEscapeURLs() const = 0;
+
+ /**
+ * Set the value for run-time escaping of URLs. This can
+ * override the property specified by the stylesheet. The
+ * default behavior is to honor the property in the stylesheet.
+ *
+ * @param value The value of the enum
+ */
+ virtual void
+ setEscapeURLs(eEscapeURLs value) = 0;
+
+
+ /**
+ * Enums to determine whether or not run-time omission of the META tag has been set.
+ */
+ enum eOmitMETATag
+ {
+ eOmitMETATagDefault, // Use the value in the stylesheet
+ eOmitMETATagNo, // Don't omit the META tag
+ eOmitMETATagYes // Omit the META tag
+ };
+
+ /**
+ * Get the value for run-time omission of URLs. This can
+ * override the property specified by the stylesheet. The
+ * default behavior is to honor the property in the stylesheet.
+ *
+ * @return The value of the enum
+ */
+ virtual eOmitMETATag
+ getOmitMETATag() const = 0;
+
+ /**
+ * Get the value for run-time omission of URLs. This can
+ * override the property specified by the stylesheet. The
+ * default behavior is to honor the property in the stylesheet.
+ *
+ * @param value The value of the enum
+ */
+ virtual void
+ setOmitMETATag(eOmitMETATag value) = 0;
+
+ /**
* Create a new FormatterToXML instance. The execution context
* owns the instance and will delete it when reset.
*
@@ -1263,11 +1324,8 @@
* type declaration
* @param doIndent true if output is to be indented
* @param indent number of spaces to indent at each nesting level
- * @param version version of the output method
- * @param standalone true if the XSLT processor should output a
- * standalone document declaration
- * @param xmlDecl true if the XSLT processor should output an XML
- * declaration
+ * @param escapeURLs Whether or not to escape URLs according to the recommendation. The default is true.
+ * @param omitMetaTag Whether or not to output a META TAG according to the recommendation. The default is false.
* @return a pointer to the new instance.
*/
virtual FormatterToHTML*
@@ -1279,9 +1337,8 @@
const XalanDOMString& doctypePublic = XalanDOMString(),
bool doIndent = true,
int indent = eDefaultHTMLIndentAmount,
- const XalanDOMString& version = XalanDOMString(),
- const XalanDOMString& standalone = XalanDOMString(),
- bool xmlDecl = false) = 0;
+ bool escapeURLs = true,
+ bool omitMetaTag = false) = 0;
/**
* Construct a FormatterToDOM instance. it will add the DOM nodes
1.97 +42 -9 xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.cpp
Index: StylesheetExecutionContextDefault.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.cpp,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -r1.96 -r1.97
--- StylesheetExecutionContextDefault.cpp 12 Aug 2002 04:02:41 -0000 1.96
+++ StylesheetExecutionContextDefault.cpp 13 Aug 2002 05:37:06 -0000 1.97
@@ -168,7 +168,9 @@
m_documentFragmentAllocator(eDocumentFragmentAllocatorBlockSize),
m_documentAllocator(eDocumentAllocatorBlockSize),
m_usePerInstanceDocumentFactory(true),
- m_cloneTextNodesOnly(false)
+ m_cloneTextNodesOnly(false),
+ m_escapeURLs(eEscapeURLsDefault),
+ m_omitMETATag(eOmitMETATagDefault)
{
}
@@ -209,7 +211,8 @@
m_documentFragmentAllocator(eDocumentFragmentAllocatorBlockSize),
m_documentAllocator(eDocumentAllocatorBlockSize),
m_usePerInstanceDocumentFactory(true),
- m_cloneTextNodesOnly(false)
+ m_cloneTextNodesOnly(false),
+ m_escapeURLs(eEscapeURLsDefault)
{
}
@@ -1212,7 +1215,39 @@
}
-
+
+StylesheetExecutionContextDefault::eEscapeURLs
+StylesheetExecutionContextDefault::getEscapeURLs() const
+{
+ return m_escapeURLs;
+}
+
+
+
+void
+StylesheetExecutionContextDefault::setEscapeURLs(eEscapeURLs value)
+{
+ m_escapeURLs = value;
+}
+
+
+
+StylesheetExecutionContextDefault::eOmitMETATag
+StylesheetExecutionContextDefault::getOmitMETATag() const
+{
+ return m_omitMETATag;
+}
+
+
+
+void
+StylesheetExecutionContextDefault::setOmitMETATag(eOmitMETATag value)
+{
+ m_omitMETATag = value;
+}
+
+
+
FormatterToXML*
StylesheetExecutionContextDefault::createFormatterToXML(
Writer& writer,
@@ -1255,9 +1290,8 @@
const XalanDOMString& doctypePublic,
bool doIndent,
int indent,
- const XalanDOMString& version,
- const XalanDOMString& standalone,
- bool xmlDecl)
+ bool escapeURLs,
+ bool omitMetaTag)
{
FormatterToHTML* const theFormatter =
new FormatterToHTML(
@@ -1268,9 +1302,8 @@
doctypePublic,
doIndent,
indent,
- version,
- standalone,
- xmlDecl);
+ escapeURLs,
+ omitMetaTag);
// Check to see if the user has asked us to ignore
// namespaces in HTML output.
1.82 +22 -5 xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.hpp
Index: StylesheetExecutionContextDefault.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.hpp,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -r1.81 -r1.82
--- StylesheetExecutionContextDefault.hpp 12 Aug 2002 04:02:41 -0000 1.81
+++ StylesheetExecutionContextDefault.hpp 13 Aug 2002 05:37:06 -0000 1.82
@@ -561,12 +561,24 @@
virtual bool
returnXResultTreeFrag(XResultTreeFrag* theXResultTreeFrag);
+ virtual eEscapeURLs
+ getEscapeURLs() const;
+
+ virtual void
+ setEscapeURLs(eEscapeURLs value);
+
+ virtual eOmitMETATag
+ getOmitMETATag() const;
+
+ void
+ setOmitMETATag(eOmitMETATag value);
+
virtual FormatterToXML*
createFormatterToXML(
Writer& writer,
const XalanDOMString& version = XalanDOMString(),
bool doIndent = false,
- int indent = 0,
+ int indent = eDefaultXMLIndentAmount,
const XalanDOMString& encoding = XalanDOMString(),
const XalanDOMString& mediaType = XalanDOMString(),
const XalanDOMString& doctypeSystem = XalanDOMString(),
@@ -582,10 +594,9 @@
const XalanDOMString& doctypeSystem = XalanDOMString(),
const XalanDOMString& doctypePublic = XalanDOMString(),
bool doIndent = true,
- int indent = 4,
- const XalanDOMString& version = XalanDOMString(),
- const XalanDOMString& standalone = XalanDOMString(),
- bool xmlDecl = false);
+ int indent = eDefaultHTMLIndentAmount,
+ bool escapeURLs = true,
+ bool omitMetaTag = false);
virtual FormatterToDOM*
createFormatterToDOM(
@@ -1154,6 +1165,12 @@
// If true, only text nodes will be cloned in the output...
bool m_cloneTextNodesOnly;
+
+ // Determines whether or not to override the property in the stylesheet.
+ eEscapeURLs m_escapeURLs;
+
+ // Determines whether or not to override the property in the stylesheet.
+ eOmitMETATag m_omitMETATag;
static XalanNumberFormatFactory s_defaultXalanNumberFormatFactory;
1.60 +117 -15 xml-xalan/c/src/XSLT/StylesheetRoot.cpp
Index: StylesheetRoot.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetRoot.cpp,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- StylesheetRoot.cpp 24 Jul 2002 23:19:43 -0000 1.59
+++ StylesheetRoot.cpp 13 Aug 2002 05:37:07 -0000 1.60
@@ -139,8 +139,10 @@
m_defaultTextRule(0),
m_defaultRule(0),
m_defaultRootRule(0),
- m_needToBuildKeysTable(false)
-
+ m_needToBuildKeysTable(false),
+ m_outputEscapeURLs(true),
+ m_indentAmount(-1),
+ m_omitMETATag(false)
{
// Our base class has already resolved the URI and pushed it on
// the back of the include stack, so get it from there...
@@ -316,21 +318,75 @@
}
}
- int indentAmount = executionContext.getIndent();
+ int indentAmount = executionContext.getIndent();
+
+ // If the indent amount is less than 0, that means use
+ // the value specified in the stylesheet.
+ if (indentAmount < 0)
+ {
+ indentAmount = m_indentAmount;
+ }
const bool doIndent = (indentAmount > -1) ? true : m_indentResult;
switch(m_outputMethod)
{
case FormatterListener::OUTPUT_METHOD_HTML:
- if (doIndent == true && indentAmount < 0)
{
- indentAmount = FormatterToHTML::eDefaultIndentAmount;
+ if (doIndent == true && indentAmount < 0)
+ {
+ indentAmount = FormatterToHTML::eDefaultIndentAmount;
+ }
+
+ // Start with the default that was set in the stylesheet...
+ bool outputEscapeURLs = m_outputEscapeURLs;
+
+ {
+ const StylesheetExecutionContext::eEscapeURLs eEscapeURLs =
+ executionContext.getEscapeURLs();
+
+ // If it's anything other than StylesheetExecutionContext::eEscapeURLsDefault,
+ // use the property from the execution context...
+ if (eEscapeURLs == StylesheetExecutionContext::eEscapeURLsNo)
+ {
+ outputEscapeURLs = false;
+ }
+ else if (eEscapeURLs == StylesheetExecutionContext::eEscapeURLsYes)
+ {
+ outputEscapeURLs = true;
+ }
+ }
+
+ // Start with the default that was set in the stylesheet...
+ bool omitMETATag = m_omitMETATag;
+
+ {
+ const StylesheetExecutionContext::eOmitMETATag eOmitMETATag =
+ executionContext.getOmitMETATag();
+
+ // If it's anything other than StylesheetExecutionContext::eOmitMETATagDefault,
+ // use the property from the execution context...
+ if (eOmitMETATag == StylesheetExecutionContext::eOmitMETATagNo)
+ {
+ omitMETATag = false;
+ }
+ else if (eOmitMETATag == StylesheetExecutionContext::eOmitMETATagYes)
+ {
+ omitMETATag = true;
+ }
+ }
+
+ flistener = executionContext.createFormatterToHTML(
+ *pw,
+ m_encoding,
+ m_mediatype,
+ m_doctypeSystem,
+ m_doctypePublic,
+ doIndent,
+ indentAmount,
+ outputEscapeURLs,
+ omitMETATag);
}
-
- flistener = executionContext.createFormatterToHTML(
- *pw, m_encoding, m_mediatype, m_doctypeSystem, m_doctypePublic,
- doIndent, indentAmount, m_version, m_standalone, !m_omitxmlDecl);
break;
case FormatterListener::OUTPUT_METHOD_TEXT:
@@ -413,9 +469,11 @@
const AttributeList& atts,
StylesheetConstructionContext& constructionContext)
{
- const unsigned int nAttrs = atts.getLength();
+ const unsigned int nAttrs = atts.getLength();
- bool didSpecifyIndent = false;
+ bool didSpecifyIndent = false;
+
+ const Locator* const theLocator = constructionContext.getLocatorFromStack();
for(unsigned int i = 0; i < nAttrs; i++)
{
@@ -426,11 +484,21 @@
const XalanDOMChar* const method = atts.getValue(i);
if(equals(method, Constants::ATTRVAL_OUTPUT_METHOD_HTML))
+ {
m_outputMethod = FormatterListener::OUTPUT_METHOD_HTML;
+ }
else if(equals(method, Constants::ATTRVAL_OUTPUT_METHOD_XML))
+ {
m_outputMethod = FormatterListener::OUTPUT_METHOD_XML;
+ }
else if(equals(method, Constants::ATTRVAL_OUTPUT_METHOD_TEXT))
+ {
m_outputMethod = FormatterListener::OUTPUT_METHOD_TEXT;
+ }
+ else
+ {
+ constructionContext.warn(XalanDOMString(aname) + " has an unknown method: " + method, 0, theLocator);
+ }
}
else if(equals(aname, Constants::ATTRNAME_OUTPUT_VERSION))
{
@@ -439,6 +507,7 @@
else if(equals(aname,Constants::ATTRNAME_OUTPUT_INDENT))
{
m_indentResult = getYesOrNo(aname, atts.getValue(i), constructionContext);
+
didSpecifyIndent = true;
}
else if(equals(aname,Constants::ATTRNAME_OUTPUT_ENCODING))
@@ -476,8 +545,6 @@
XalanDOMString theToken;
- const Locator* const theLocator = constructionContext.getLocatorFromStack();
-
while(theTokenCount > 0)
{
theTokenizer.nextToken(theToken);
@@ -490,9 +557,44 @@
assert(theTokenizer.hasMoreTokens() == false);
}
- else if (isAttrOK(aname, atts, i, constructionContext) == false)
+ else
{
- constructionContext.error(XalanDOMString(name) + " has an illegal attribute: " + aname);
+ const XalanQNameByValue theAttributeName(aname, getNamespaces(), theLocator);
+
+ if (theAttributeName.getNamespace() == constructionContext.getXalanXSLNameSpaceURL())
+ {
+ if (theAttributeName.getLocalPart() == Constants::ATTRNAME_ESCAPE_URLS)
+ {
+ m_outputEscapeURLs = getYesOrNo(aname, atts.getValue(i), constructionContext);
+ }
+ else if (theAttributeName.getLocalPart() == Constants::ATTRNAME_INDENTAMOUNT)
+ {
+ m_indentAmount = WideStringToInt(atts.getValue(i));
+
+ if (m_indentAmount < 0)
+ {
+ m_indentAmount = 0;
+ }
+ }
+ else if (theAttributeName.getLocalPart() == Constants::ATTRNAME_OMIT_META_TAG)
+ {
+ m_omitMETATag = getYesOrNo(aname, atts.getValue(i), constructionContext);
+ }
+ else
+ {
+ constructionContext.warn(
+ theAttributeName.getLocalPart() + " is an unsupported Xalan-specific attribute",
+ 0,
+ theLocator);
+ }
+ }
+ else if (isAttrOK(aname, atts, i, constructionContext) == false)
+ {
+ constructionContext.error(
+ XalanDOMString(name) + " has an illegal attribute: " + aname,
+ 0,
+ theLocator);
+ }
}
}
1.19 +18 -2 xml-xalan/c/src/XSLT/StylesheetRoot.hpp
Index: StylesheetRoot.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetRoot.hpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- StylesheetRoot.hpp 24 Jul 2002 23:19:43 -0000 1.18
+++ StylesheetRoot.hpp 13 Aug 2002 05:37:07 -0000 1.19
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -494,7 +494,23 @@
*/
bool m_needToBuildKeysTable;
- // Not implemented...
+ /**
+ * This is set to true if URLs should be escaped in HTML output (the default)
+ */
+ bool m_outputEscapeURLs;
+
+ /**
+ * The amount to indent. The default is -1, which indicates not to indent.
+ */
+ int m_indentAmount;
+
+ /**
+ * This is set to true if we should omit the META tag in HTML output (the default is false)
+ */
+ bool m_omitMETATag;
+
+
+ // Not implemented...
StylesheetRoot(const StylesheetRoot&);
StylesheetRoot&
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org