xalan-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbert...@apache.org
Subject cvs commit: xml-xalan/c/src/xalanc/XPath XPath.cpp
Date Thu, 18 Aug 2005 01:09:58 GMT
dbertoni    2005/08/17 18:09:58

  Modified:    c/src/xalanc/XPath XPath.cpp
  Log:
  Fix for Jira issue XALANC-540.
  
  Revision  Changes    Path
  1.23      +38 -3     xml-xalan/c/src/xalanc/XPath/XPath.cpp
  
  Index: XPath.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XPath/XPath.cpp,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- XPath.cpp	30 Jun 2005 23:35:43 -0000	1.22
  +++ XPath.cpp	18 Aug 2005 01:09:58 -0000	1.23
  @@ -3456,6 +3456,7 @@
               OpCodeMapValueType      /* stepType */,
               MutableNodeRefList&     subQueryResults) const
   {
  +    assert(context != 0);
       assert(subQueryResults.empty() == true);
   
       const XPathExpression&  currentExpression = getExpression();
  @@ -3463,9 +3464,43 @@
       const OpCodeMapValueType    argLen =
           currentExpression.getOpCodeArgumentLength(opPos);
   
  -    XalanNode* const    docContext = XalanNode::DOCUMENT_NODE == context->getNodeType()
?
  -                                    context :
  -                                    context->getOwnerDocument();
  +    XalanNode::NodeType   nodeType =
  +                context->getNodeType();
  +
  +    XalanNode*  docContext =
  +        nodeType == XalanNode::DOCUMENT_NODE ?
  +            context :
  +            context->getOwnerDocument();
  +
  +    // This is a special case for RTFs, as the "owner document" is
  +    // just a factory for the RTF.  Instead, we have to search for
  +    // the containing XalanDocumentFragment node.
  +#if defined(XALAN_OLD_STYLE_CASTS)
  +    if (((const XalanDocument*)docContext)->getDocumentElement() == 0)
  +#else
  +    if (static_cast<const XalanDocument*>(docContext)->getDocumentElement() ==
0)
  +#endif
  +    {
  +        docContext = context;
  +
  +        for(;;)
  +        {
  +            if (nodeType == XalanNode::DOCUMENT_FRAGMENT_NODE)
  +            {
  +                break;
  +            }
  +            else
  +            {
  +                docContext =
  +                    DOMServices::getParentOfNode(*docContext);
  +                assert(docContext != 0);
  +
  +                nodeType = docContext->getNodeType();
  +
  +            }
  +        }
  +    }
  +
       assert(docContext != 0);
   
       subQueryResults.addNode(docContext);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org


Mime
View raw message