You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by sb...@locus.apache.org on 2000/02/23 09:53:00 UTC

cvs commit: xml-xalan/src/org/apache/xalan/xslt Stylesheet.java XSLTEngineImpl.java

sboag       00/02/23 00:53:00

  Modified:    src/org/apache/xalan/xpath XPathProcessorImpl.java
               src/org/apache/xalan/xslt Stylesheet.java
                        XSLTEngineImpl.java
  Log:
  Fixed id() and key match patterns of form key(...)/foo.
  
  Revision  Changes    Path
  1.20      +30 -3     xml-xalan/src/org/apache/xalan/xpath/XPathProcessorImpl.java
  
  Index: XPathProcessorImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xpath/XPathProcessorImpl.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- XPathProcessorImpl.java	2000/02/23 06:07:03	1.19
  +++ XPathProcessorImpl.java	2000/02/23 08:52:59	1.20
  @@ -581,11 +581,30 @@
     {
       String prefix = pat.substring(startSubstring, posOfNSSep);
       String uName;
  -    if(null != m_namespaceContext)
  +    if((null != m_namespaceContext) && !prefix.equals("*") && !prefix.equals("xmlns"))
       {
         try
         {
  -        uName = ((PrefixResolver)m_namespaceContext).getNamespaceForPrefix(prefix);
  +        if(prefix.length() > 0)
  +          uName = ((PrefixResolver)m_namespaceContext).getNamespaceForPrefix(prefix);
  +        else
  +        {
  +          // Assume last was wildcard. This is not legal according 
  +          // to the draft. Set the below to true to make namespace 
  +          // wildcards work.
  +          if(false)
  +          {
  +            addToTokenQueue(":");
  +            String s = pat.substring(posOfNSSep+1, posOfScan);
  +            if(s.length() > 0)
  +              addToTokenQueue(s);
  +            return -1;
  +          }
  +          else
  +          {
  +            uName = ((PrefixResolver)m_namespaceContext).getNamespaceForPrefix(prefix);
  +          }
  +        }
         }
         catch(ClassCastException cce)
         {
  @@ -2467,8 +2486,16 @@
       if(lookahead('(', 1) && (tokenIs(FUNC_ID_STRING) || tokenIs(FUNC_KEY_STRING)))
       {
         IdKeyPattern();
  +      if(tokenIs('/') && lookahead('/', 1))
  +      {
  +        appendOp(4, m_xpath.MATCH_ANY_ANCESTOR);
  +        // Tell how long the step is without the predicate
  +        m_xpath.m_opMap[m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] - 2] = 4;
  +        m_xpath.m_opMap[m_xpath.m_opMap[m_xpath.MAPINDEX_LENGTH] - 1] = m_xpath.NODETYPE_ROOT;
  +        nextToken();
  +      }
       }
  -    if(tokenIs('/'))
  +    else if(tokenIs('/'))
       {      
         if(lookahead('/', 1))
         {
  
  
  
  1.30      +0 -1      xml-xalan/src/org/apache/xalan/xslt/Stylesheet.java
  
  Index: Stylesheet.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xslt/Stylesheet.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- Stylesheet.java	2000/02/23 06:07:04	1.29
  +++ Stylesheet.java	2000/02/23 08:52:59	1.30
  @@ -975,7 +975,6 @@
             var.execute(transformContext, transformContext.m_rootDoc, transformContext.m_rootDoc, null);
           }
         }
  -      transformContext.getVarStack().markGlobalStackFrame();
       }
       catch(Exception e)
       {
  
  
  
  1.45      +1 -0      xml-xalan/src/org/apache/xalan/xslt/XSLTEngineImpl.java
  
  Index: XSLTEngineImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xslt/XSLTEngineImpl.java,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- XSLTEngineImpl.java	2000/02/23 06:07:04	1.44
  +++ XSLTEngineImpl.java	2000/02/23 08:53:00	1.45
  @@ -3256,6 +3256,7 @@
       SAXException
     {
       m_stylesheetRoot.pushTopLevelVariables(m_topLevelParams, this);
  +    getVarStack().markGlobalStackFrame();
     }
   
     /**