dbertoni 2003/07/02 16:13:55
Modified: c/src/xalanc/XSLT XSLTEngineImpl.cpp XSLTEngineImpl.hpp
Log:
Handle document fragments consistently. Fixes bugzilla 21293.
Revision Changes Path
1.3 +27 -9 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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XSLTEngineImpl.cpp 1 Jul 2003 23:48:05 -0000 1.2
+++ XSLTEngineImpl.cpp 2 Jul 2003 23:13:55 -0000 1.3
@@ -2129,7 +2129,18 @@
{
XalanNode::NodeType posNodeType = node.getNodeType();
- if (cloneTextNodesOnly == true &&
+ if (posNodeType == XalanNode::DOCUMENT_FRAGMENT_NODE)
+ {
+ outputResultTreeFragment(
+#if defined(XALAN_OLD_STYLE_CASTS)
+ (const XalanDocumentFragment&)node,
+#else
+ static_cast<const XalanDocumentFragment&>(node),
+#endif
+ cloneTextNodesOnly,
+ styleNode);
+ }
+ else if (cloneTextNodesOnly == true &&
posNodeType != XalanNode::TEXT_NODE)
{
warnCopyTextNodesOnly(
@@ -2177,7 +2188,11 @@
posNodeType = pos->getNodeType();
- if(&node == pos)
+ if (posNodeType ==
XalanNode::DOCUMENT_FRAGMENT_NODE)
+ {
+ break;
+ }
+ else if (&node == pos)
{
if(XalanNode::ELEMENT_NODE ==
posNodeType)
{
@@ -2311,6 +2326,10 @@
c_wstr(node.getNodeValue()));
break;
+ case XalanNode::DOCUMENT_FRAGMENT_NODE:
+ assert(false);
+ break;
+
// Can't really do this, but we won't throw an error so that
copy-of will
// work
case XalanNode::DOCUMENT_NODE:
@@ -2432,7 +2451,8 @@
case XObject::eTypeUnknown:
case XObject::eUnknown:
default:
- assert(0);
+ assert(false);
+ break;
}
}
@@ -2440,13 +2460,11 @@
void
XSLTEngineImpl::outputResultTreeFragment(
- const XObject& theTree,
- bool
outputTextNodesOnly,
- const ElemTemplateElement* styleNode)
+ const XalanDocumentFragment& theTree,
+ bool
outputTextNodesOnly,
+ const ElemTemplateElement* styleNode)
{
- const ResultTreeFragBase& docFrag = theTree.rtree();
-
- const XalanNodeList* const nl = docFrag.getChildNodes();
+ const XalanNodeList* const nl = theTree.getChildNodes();
assert(nl != 0);
const unsigned int nChildren = nl->getLength();
1.2 +18 -1 xml-xalan/c/src/xalanc/XSLT/XSLTEngineImpl.hpp
Index: XSLTEngineImpl.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/XSLTEngineImpl.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XSLTEngineImpl.hpp 29 Jun 2003 03:58:08 -0000 1.1
+++ XSLTEngineImpl.hpp 2 Jul 2003 23:13:55 -0000 1.2
@@ -767,7 +767,24 @@
outputResultTreeFragment(
const XObject& theTree,
bool
outputTextNodesOnly,
- const ElemTemplateElement* styleNode);
+ const ElemTemplateElement* styleNode)
+ {
+ outputResultTreeFragment(theTree.rtree(), outputTextNodesOnly,
styleNode);
+ }
+
+ /**
+ * Given a result tree fragment, walk the tree and output it to the
result
+ * stream.
+ *
+ * @param theTree result tree fragment
+ * @param outputTextNodesOnly if true, only text nodes will be copied
+ * @param styleNode the stylesheet element that generate the
fragment.
+ */
+ void
+ outputResultTreeFragment(
+ const XalanDocumentFragment& theTree,
+ bool
outputTextNodesOnly,
+ const ElemTemplateElement* styleNode);
/**
* Retrieve the root stylesheet.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]