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 2008/06/02 00:27:07 UTC

svn commit: r662296 - in /xalan/c/trunk/src/xalanc: NLS/en_US/ XPath/ XSLT/

Author: dbertoni
Date: Sun Jun  1 15:27:06 2008
New Revision: 662296

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

Modified:
    xalan/c/trunk/src/xalanc/NLS/en_US/XalanMsg_en_US.xlf
    xalan/c/trunk/src/xalanc/XPath/XPathExecutionContext.hpp
    xalan/c/trunk/src/xalanc/XPath/XPathExecutionContextDefault.cpp
    xalan/c/trunk/src/xalanc/XPath/XPathExecutionContextDefault.hpp
    xalan/c/trunk/src/xalanc/XPath/XalanQName.cpp
    xalan/c/trunk/src/xalanc/XPath/XalanQName.hpp
    xalan/c/trunk/src/xalanc/XSLT/FunctionKey.cpp
    xalan/c/trunk/src/xalanc/XSLT/KeyTable.cpp
    xalan/c/trunk/src/xalanc/XSLT/KeyTable.hpp
    xalan/c/trunk/src/xalanc/XSLT/ProblemListenerDefault.cpp
    xalan/c/trunk/src/xalanc/XSLT/StylesheetExecutionContext.hpp
    xalan/c/trunk/src/xalanc/XSLT/StylesheetExecutionContextDefault.cpp
    xalan/c/trunk/src/xalanc/XSLT/StylesheetExecutionContextDefault.hpp
    xalan/c/trunk/src/xalanc/XSLT/StylesheetRoot.cpp
    xalan/c/trunk/src/xalanc/XSLT/StylesheetRoot.hpp

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=662296&r1=662295&r2=662296&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 Sun Jun  1 15:27:06 2008
@@ -983,6 +983,11 @@
 		<target>The Unicode code point '{0}' is not a legal XML {1} character.</target>
 </trans-unit>
 
+<trans-unit id="UnknownKey_1Param">
+        <source>There is no xsl:key instruction with the expanded name '{0}'.</source>
+        <target>There is no xsl:key instruction with the expanded name '{0}'.</target>
+</trans-unit>
+
 
     </body>
   </file>

Modified: xalan/c/trunk/src/xalanc/XPath/XPathExecutionContext.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/XPathExecutionContext.hpp?rev=662296&r1=662295&r2=662296&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/XPathExecutionContext.hpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/XPathExecutionContext.hpp Sun Jun  1 15:27:06 2008
@@ -501,6 +501,7 @@
      *                         attribute on xsl:key
      * @param ref              value that must match the value found by the
      *                         'match' attribute on xsl:key
+     * @param locator          The LocatorType to use for error reporting.  Can be 0.
      * @param nodelist         A node list to contain the nodes found
      */
     virtual void
@@ -508,6 +509,7 @@
             XalanNode*              context,
             const XalanQName&       qname,
             const XalanDOMString&   ref,
+            const LocatorType*      locator,
             MutableNodeRefList&     nodelist) = 0;
 
     /**

Modified: xalan/c/trunk/src/xalanc/XPath/XPathExecutionContextDefault.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/XPathExecutionContextDefault.cpp?rev=662296&r1=662295&r2=662296&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/XPathExecutionContextDefault.cpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/XPathExecutionContextDefault.cpp Sun Jun  1 15:27:06 2008
@@ -402,6 +402,7 @@
             XalanNode*              /* context */,
             const XalanQName&       /* qname */,
             const XalanDOMString&   /* ref */,
+            const LocatorType*      /* locator */,
             MutableNodeRefList&     /* nodelist */)
 {
 }

Modified: xalan/c/trunk/src/xalanc/XPath/XPathExecutionContextDefault.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/XPathExecutionContextDefault.hpp?rev=662296&r1=662295&r2=662296&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/XPathExecutionContextDefault.hpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/XPathExecutionContextDefault.hpp Sun Jun  1 15:27:06 2008
@@ -264,7 +264,8 @@
             XalanNode*              context,
 			const XalanQName&		qname,
 			const XalanDOMString&	ref,
-			MutableNodeRefList&		nodelist);
+            const LocatorType*      locator,
+		    MutableNodeRefList&		nodelist);
 
 	virtual void
 	getNodeSetByKey(

Modified: xalan/c/trunk/src/xalanc/XPath/XalanQName.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/XalanQName.cpp?rev=662296&r1=662295&r2=662296&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/XalanQName.cpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/XalanQName.cpp Sun Jun  1 15:27:06 2008
@@ -43,6 +43,25 @@
 
 
 
+XalanDOMString&
+XalanQName::format(XalanDOMString&  theString) const
+{
+    const XalanDOMString& theURI = getNamespace();
+
+    if (theURI.empty() == false)
+    {
+        theString += XalanDOMChar(XalanUnicode::charRightCurlyBracket);
+        theString += theURI;
+        theString += XalanDOMChar(XalanUnicode::charLeftCurlyBracket);
+    }
+
+    theString += getLocalPart();
+
+    return theString;
+}
+
+
+
 XalanQName::PrefixResolverProxy::PrefixResolverProxy(
             const NamespacesStackType&  theStack,
             const XalanDOMString&       theURI) :

Modified: xalan/c/trunk/src/xalanc/XPath/XalanQName.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XPath/XalanQName.hpp?rev=662296&r1=662295&r2=662296&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XPath/XalanQName.hpp (original)
+++ xalan/c/trunk/src/xalanc/XPath/XalanQName.hpp Sun Jun  1 15:27:06 2008
@@ -148,6 +148,17 @@
                getNamespace() == theRHS.getNamespace();
     }
 
+    /**
+     * Format the QName using the notation "{namespace-uri}local-part" or
+     * "local-part" if the namespace URI is empty.  The result is appended
+     * to the provided string.
+     * 
+     * @param theString The string to format with the
+     * @return A reference to the parameter.
+     */
+    XalanDOMString&
+    format(XalanDOMString&  theString) const;
+
     size_t
     hash() const
     {

Modified: xalan/c/trunk/src/xalanc/XSLT/FunctionKey.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XSLT/FunctionKey.cpp?rev=662296&r1=662295&r2=662296&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XSLT/FunctionKey.cpp (original)
+++ xalan/c/trunk/src/xalanc/XSLT/FunctionKey.cpp Sun Jun  1 15:27:06 2008
@@ -85,6 +85,7 @@
                 context,
                 theQName,
                 ref,
+                locator,
                 theNodeRefList);
     }
 }

Modified: xalan/c/trunk/src/xalanc/XSLT/KeyTable.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XSLT/KeyTable.cpp?rev=662296&r1=662295&r2=662296&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XSLT/KeyTable.cpp (original)
+++ xalan/c/trunk/src/xalanc/XSLT/KeyTable.cpp Sun Jun  1 15:27:06 2008
@@ -220,7 +220,7 @@
 
 
 
-const MutableNodeRefList&
+const MutableNodeRefList*
 KeyTable::getNodeSetByKey(
                       const XalanQName&         qname, 
                       const XalanDOMString&     ref) const
@@ -235,14 +235,15 @@
 
         if (j != theMap.end())
         {
-            return (*j).second;
+            return &(*j).second;
+        }
+        else
+        {
+            return &s_dummyList;
         }
     }
 
-    // It makes things much easier if we always return
-    // a list of nodes.  So this is just an empty one
-    // to return when the ref is not found.
-    return s_dummyList;
+    return 0;
 }
 
 

Modified: xalan/c/trunk/src/xalanc/XSLT/KeyTable.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XSLT/KeyTable.hpp?rev=662296&r1=662295&r2=662296&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XSLT/KeyTable.hpp (original)
+++ xalan/c/trunk/src/xalanc/XSLT/KeyTable.hpp Sun Jun  1 15:27:06 2008
@@ -116,7 +116,7 @@
 	 *             attribute on xsl:key
 	 * @return		pointer to nodeset for key 
 	 */
-	const MutableNodeRefList&
+	const MutableNodeRefList*
 	getNodeSetByKey(
 				  const XalanQName&			qname,
 				  const XalanDOMString&		ref) const;
@@ -151,7 +151,7 @@
 
 	KeysMapType							m_keys;
 
-	static const MutableNodeRefList		s_dummyList;
+    static const MutableNodeRefList     s_dummyList;
 };
 
 

Modified: xalan/c/trunk/src/xalanc/XSLT/ProblemListenerDefault.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XSLT/ProblemListenerDefault.cpp?rev=662296&r1=662295&r2=662296&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XSLT/ProblemListenerDefault.cpp (original)
+++ xalan/c/trunk/src/xalanc/XSLT/ProblemListenerDefault.cpp Sun Jun  1 15:27:06 2008
@@ -196,7 +196,7 @@
             msg);
     }
 
-    pw.print(theBuffer);
+    pw.println(theBuffer);
 
     if (0 != styleNode)
     {

Modified: xalan/c/trunk/src/xalanc/XSLT/StylesheetExecutionContext.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XSLT/StylesheetExecutionContext.hpp?rev=662296&r1=662295&r2=662296&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XSLT/StylesheetExecutionContext.hpp (original)
+++ xalan/c/trunk/src/xalanc/XSLT/StylesheetExecutionContext.hpp Sun Jun  1 15:27:06 2008
@@ -1985,6 +1985,7 @@
             XalanNode*              context,
             const XalanQName&       qname,
             const XalanDOMString&   ref,
+            const LocatorType*      locator,
             MutableNodeRefList&     nodelist) = 0;
 
     virtual void

Modified: xalan/c/trunk/src/xalanc/XSLT/StylesheetExecutionContextDefault.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XSLT/StylesheetExecutionContextDefault.cpp?rev=662296&r1=662295&r2=662296&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XSLT/StylesheetExecutionContextDefault.cpp (original)
+++ xalan/c/trunk/src/xalanc/XSLT/StylesheetExecutionContextDefault.cpp Sun Jun  1 15:27:06 2008
@@ -2111,6 +2111,7 @@
             XalanNode*              context,
             const XalanQName&       qname,
             const XalanDOMString&   ref,
+            const LocatorType*      locator,
             MutableNodeRefList&     nodelist)
 {
     assert(m_stylesheetRoot != 0);
@@ -2122,6 +2123,7 @@
         *getPrefixResolver(),
         nodelist,
         *this,
+        locator,
         m_keyTables);
 }
 
@@ -2153,6 +2155,7 @@
         *resolver,
         nodelist,
         *this,
+        locator,
         m_keyTables);
 }
 

Modified: xalan/c/trunk/src/xalanc/XSLT/StylesheetExecutionContextDefault.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XSLT/StylesheetExecutionContextDefault.hpp?rev=662296&r1=662295&r2=662296&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XSLT/StylesheetExecutionContextDefault.hpp (original)
+++ xalan/c/trunk/src/xalanc/XSLT/StylesheetExecutionContextDefault.hpp Sun Jun  1 15:27:06 2008
@@ -87,9 +87,6 @@
 //
 class XALAN_XSLT_EXPORT StylesheetExecutionContextDefault : public StylesheetExecutionContext
 {
-
-
-
 public:
 
 #if defined(XALAN_STRICT_ANSI_HEADERS)
@@ -936,6 +933,7 @@
             XalanNode*              context,
             const XalanQName&       qname,
             const XalanDOMString&   ref,
+            const LocatorType*      locator,
             MutableNodeRefList&     nodelist);
 
     virtual void

Modified: xalan/c/trunk/src/xalanc/XSLT/StylesheetRoot.cpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XSLT/StylesheetRoot.cpp?rev=662296&r1=662295&r2=662296&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XSLT/StylesheetRoot.cpp (original)
+++ xalan/c/trunk/src/xalanc/XSLT/StylesheetRoot.cpp Sun Jun  1 15:27:06 2008
@@ -810,12 +810,14 @@
             const PrefixResolver&           resolver,
             MutableNodeRefList&             nodelist,
             StylesheetExecutionContext&     executionContext,
+            const LocatorType*              locator,
             KeyTablesTableType&             theKeysTable) const
 {
     assert(
         nodelist.empty() == true ||
         nodelist.getDocumentOrder() == true);
 
+    const MutableNodeRefList* nl = 0;
     XalanNode* const    theKeyNode = getKeyNode(context);
     assert(theKeyNode != 0);
 
@@ -828,17 +830,7 @@
 
         if (i != theKeysTable.end())
         {
-            const MutableNodeRefList&   nl =
-                i->second->getNodeSetByKey(qname, ref);
-
-            if (nodelist.empty() == true)
-            {
-                nodelist = nl;
-            }
-            else
-            {
-                nodelist.addNodesInDocOrder(nl, executionContext);
-            }
+            nl = i->second->getNodeSetByKey(qname, ref);
         }
         else
         {
@@ -855,19 +847,31 @@
 
             const KeyTable* const   theNewTable = kt.releasePtr();
 
-            const MutableNodeRefList&   nl =
-                theNewTable->getNodeSetByKey(qname, ref);
-
-            if (nodelist.empty() == true)
-            {
-                nodelist = nl;
-            }
-            else
-            {
-                nodelist.addNodesInDocOrder(nl, executionContext);
-            }
+            nl = theNewTable->getNodeSetByKey(qname, ref);
         }
     }
+
+    if (nl == 0)
+    {
+        const GetCachedString   theGuard1(executionContext);
+        const GetCachedString   theGuard2(executionContext);
+
+        executionContext.error(
+            XalanMessageLoader::getMessage(
+                theGuard1.get(),
+                XalanMessages::UnknownKey_1Param,
+                qname.format(theGuard2.get())),
+            executionContext.getCurrentNode(),
+            locator);
+    }
+    else if (nodelist.empty() == true)
+    {
+        nodelist = *nl;
+    }
+    else
+    {
+        nodelist.addNodesInDocOrder(*nl, executionContext);
+    }
 }
 
 

Modified: xalan/c/trunk/src/xalanc/XSLT/StylesheetRoot.hpp
URL: http://svn.apache.org/viewvc/xalan/c/trunk/src/xalanc/XSLT/StylesheetRoot.hpp?rev=662296&r1=662295&r2=662296&view=diff
==============================================================================
--- xalan/c/trunk/src/xalanc/XSLT/StylesheetRoot.hpp (original)
+++ xalan/c/trunk/src/xalanc/XSLT/StylesheetRoot.hpp Sun Jun  1 15:27:06 2008
@@ -385,13 +385,14 @@
      * Given a valid element key, return the corresponding node list.
      *
      * @param context		   context node
-     * @param name			   qname of the key, which must match the 'name'
+     * @param qname			   qname of the key, which must match the 'name'
      *						   attribute on xsl:key
      * @param ref			   value that must match the value found by the
      *						   'match' attribute on xsl:key
      * @param resolver		   resolver for namespace resolution
      * @param nodelist         A node list to contain the nodes found
-     * @param executionContext current execution context
+     * @param executionContext The current execution context
+     * @param theKeysTable     The table of keys to search.
      */
     void
     getNodeSetByKey(
@@ -401,6 +402,7 @@
             const PrefixResolver&			resolver,
             MutableNodeRefList&				nodelist,
             StylesheetExecutionContext&		executionContext,
+            const LocatorType*              locator,
             KeyTablesTableType&				theKeysTable) const;
 
     unsigned long



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