mmidy       01/01/24 07:13:45

  Modified:    java/compat_src/org/apache/xalan/xslt XSLTEngineImpl.java
  Log:
  handle stylesheet parameters when they are expressions
  
  Revision  Changes    Path
  1.10      +36 -1     
xml-xalan/java/compat_src/org/apache/xalan/xslt/XSLTEngineImpl.java
  
  Index: XSLTEngineImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xslt/XSLTEngineImpl.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- XSLTEngineImpl.java       2001/01/23 17:58:48     1.9
  +++ XSLTEngineImpl.java       2001/01/24 15:13:42     1.10
  @@ -153,6 +153,9 @@
     private Hashtable m_stylesheetParams;
     StylesheetRoot m_stylesheetRoot = null;
     
  +  Vector m_evalList = null;
  +  boolean m_needToEval = false;
  +  
     /*
     * If this is true, then the diag function will
     * be called.
  @@ -399,6 +402,34 @@
         if(null != inputSource)
           sourceTree = getSourceTreeFromInput(inputSource);
         Templates templates = null;
  +      if (m_needToEval)
  +      {
  +        Node node = null;
  +        if (null != stylesheetSource)
  +        {
  +          Source ssSource = stylesheetSource.getSourceObject();
  +          if(ssSource instanceof DOMSource)
  +          {
  +            node = ((DOMSource)ssSource).getNode();
  +          }
  +        }
  +        if (null == node)
  +        {
  +          node = new DOM2Helper().createDocument() ; 
  +        }
  +        for (int i=0; i< m_evalList.size(); i++)
  +        {
  +          String name = (String)m_evalList.elementAt(i);
  +          String expression = (String)m_stylesheetParams.get(name);
  +          try{
  +            org.apache.xpath.objects.XObject val = 
org.apache.xpath.XPathAPI.eval(node, expression);
  +            
  +            m_stylesheetParams.put(name, val);
  +          }
  +          catch(TransformerException te)
  +          {}
  +        }
  +      }
         if(null != stylesheetSource)
         {
           try{
  @@ -2272,13 +2303,17 @@
      * @param expression An expression that will be evaluated.
      */
     public void setStylesheetParam(String key, String expression)
  -  {
  +  {    
  +    if (m_evalList == null)
  +      m_evalList = new Vector();
  +    m_evalList.addElement(key);
       if (m_transformerImpl != null)
         m_transformerImpl.setParameter(key, null, expression);
       else
       {
         setParameter(key, expression);
       }
  +    m_needToEval = true;
     }
     
     /**
  
  
  

Reply via email to