xalan-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbert...@apache.org
Subject svn commit: r762403 - in /xalan/c/trunk/src/xalanc: NLS/en_US/XalanMsg_en_US.xlf XSLT/FunctionDocument.cpp
Date Mon, 06 Apr 2009 15:53:09 GMT
Author: dbertoni
Date: Mon Apr  6 15:53:08 2009
New Revision: 762403

URL: http://svn.apache.org/viewvc?rev=762403&view=rev
Log:
Fixes for XALANC-690.

Modified:
    xalan/c/trunk/src/xalanc/NLS/en_US/XalanMsg_en_US.xlf
    xalan/c/trunk/src/xalanc/XSLT/FunctionDocument.cpp

Modified: xalan/c/trunk/src/xalanc/NLS/en_US/XalanMsg_en_US.xlf
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/NLS/en_US/XalanMsg_en_US.xlf?rev=762403&r1=762402&r2=762403&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/NLS/en_US/XalanMsg_en_US.xlf (original)
+++ xalan/c/trunk/src/xalanc/NLS/en_US/XalanMsg_en_US.xlf Mon Apr  6 15:53:08 2009
@@ -720,8 +720,8 @@
 </trans-unit>
 
 <trans-unit id="CantFindFragment_1Param">
-		<source>Could not find the fragment '{0}'</source>
-		<target>Could not find the fragment '{0}'</target>
+		<source>The fragment '{0}' was not found.</source>
+		<target>The fragment '{0}' was not found.</target>
 </trans-unit>
 
 <trans-unit id="NodePointedByFragment_1Param">
@@ -1038,6 +1038,11 @@
         <target>The processor cannot use the HTML output method because the current
extension output method does not support it.</target>
 </trans-unit>
 
+<trans-unit id="CannotFindFragment_2Param">
+        <source>The fragment '{0}' was not found in the document '{1}'.</source>
+        <target>The fragment '{0}' was not found in the document '{1}'.</target>
+</trans-unit>
+
     </body>
   </file>
 </xliff>

Modified: xalan/c/trunk/src/xalanc/XSLT/FunctionDocument.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XSLT/FunctionDocument.cpp?rev=762403&r1=762402&r2=762403&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XSLT/FunctionDocument.cpp (original)
+++ xalan/c/trunk/src/xalanc/XSLT/FunctionDocument.cpp Mon Apr  6 15:53:08 2009
@@ -86,7 +86,35 @@
         base);
 
     executionContext.problem(
-        XPathExecutionContext::eXPath,
+        XPathExecutionContext::eXSLTProcessor,
+        XPathExecutionContext::eWarning,
+        theMessage,
+        locator,
+        sourceNode);
+}
+
+
+
+inline void
+doWarnFragID(
+            XPathExecutionContext&  executionContext,
+            const XalanDOMString&   uri,
+            const XalanDOMString&   fragID,
+            const XalanNode*        sourceNode,
+            const Locator*          locator)
+{
+    const GetCachedString   theGuard(executionContext);
+
+    XalanDOMString&     theMessage = theGuard.get();
+
+    XalanMessageLoader::getMessage(
+        theMessage,
+        XalanMessages::CannotFindFragment_2Param,
+        uri,
+        fragID);
+
+    executionContext.problem(
+        XPathExecutionContext::eXSLTProcessor,
         XPathExecutionContext::eWarning,
         theMessage,
         locator,
@@ -207,13 +235,32 @@
             const XalanNode*                    sourceNode,
             const Locator*                      locator)
 {
-    XalanDocument*  newDoc = executionContext.getSourceDocument(uri);
+    const XalanDOMString::size_type fragIndex =
+        indexOf(uri, XalanUnicode::charNumberSign);
+
+    const GetCachedString   theGuard1(executionContext);
+    const GetCachedString   theGuard2(executionContext);
+
+    XalanDOMString&     newURI = theGuard1.get();
+    XalanDOMString&     fragID = theGuard2.get();
+
+    if (fragIndex == uri.length())
+    {
+        newURI = uri;
+    }
+    else
+    {
+        substring(uri, newURI, 0, fragIndex);
+        substring(uri, fragID, fragIndex + 1);
+    }
+
+    XalanDocument*  newDoc = executionContext.getSourceDocument(newURI);
 
     if (newDoc == 0)
     {
-        if (uri.length() != 0)
+        if (newURI.length() != 0)
         {
-            newDoc = parseDoc(executionContext, uri, base, sourceNode, locator);
+            newDoc = parseDoc(executionContext, newURI, base, sourceNode, locator);
         }
         else
         {
@@ -231,7 +278,23 @@
 
     if (newDoc != 0)
     {
-        mnl->addNodeInDocOrder(newDoc, executionContext);
+        if (fragID.length() == 0)
+        {
+            mnl->addNodeInDocOrder(newDoc, executionContext);
+        }
+        else
+        {
+            XalanNode* const    theNode = newDoc->getElementById(fragID);
+
+            if (theNode != 0)
+            {
+                mnl->addNodeInDocOrder(theNode, executionContext);
+            }
+            else
+            {
+                doWarnFragID(executionContext, fragID, newURI, sourceNode, locator);
+            }
+        }
     }
 }
 
@@ -331,7 +394,7 @@
         const GetCachedString   theGuard1(executionContext);
 
         executionContext.problem(
-            XPathExecutionContext::eXPath,
+            XPathExecutionContext::eXSLTProcessor,
             XPathExecutionContext::eError,
             XalanMessageLoader::getMessage(
                 theGuard1.get(),
@@ -349,7 +412,7 @@
             const GetCachedString   theGuard1(executionContext);
 
             executionContext.problem(
-                XPathExecutionContext::eXPath,
+                XPathExecutionContext::eXSLTProcessor,
                 XPathExecutionContext::eError,
                 XalanMessageLoader::getMessage(
                     theGuard1.get(),
@@ -481,7 +544,7 @@
                     const GetCachedString   theGuard(executionContext);
 
                     executionContext.problem(
-                        XPathExecutionContext::eXPath,
+                        XPathExecutionContext::eXSLTProcessor,
                         XPathExecutionContext::eWarning,
                         XalanMessageLoader::getMessage(
                             theGuard.get(),



---------------------------------------------------------------------
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