zongaro     2002/10/04 02:24:47

  Modified:    java/src/org/apache/xalan/extensions Tag: XSLTC_DTM
                        ExtensionHandlerJavaPackage.java
               java/src/org/apache/xalan/processor Tag: XSLTC_DTM
                        ProcessorLRE.java XSLTElementDef.java
                        XSLTSchema.java
               java/src/org/apache/xalan/templates Tag: XSLTC_DTM
                        Constants.java ElemTemplateElement.java
                        OutputProperties.java output_html.properties
                        output_text.properties output_xml.properties
               java/src/org/apache/xalan/xslt Tag: XSLTC_DTM Process.java
               java/src/org/apache/xalan/xsltc/compiler Tag: XSLTC_DTM
                        XSLTC.java
               java/src/org/apache/xalan/xsltc/compiler/util Tag: XSLTC_DTM
                        ErrorMessages.java ErrorMsg.java Util.java
               java/src/org/apache/xalan/xsltc/runtime Tag: XSLTC_DTM
                        BasisLibrary.java ErrorMessages.java
               java/src/org/apache/xalan/xsltc/trax Tag: XSLTC_DTM
                        TemplatesHandlerImpl.java
                        TransformerFactoryImpl.java
               java/src/org/apache/xpath/functions Tag: XSLTC_DTM
                        FuncExtFunction.java
  Log:
  Folding changes from the MAIN branch back into the XSLTC_DTM branch.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.11.10.1 +1 -1      
xml-xalan/java/src/org/apache/xalan/extensions/ExtensionHandlerJavaPackage.java
  
  Index: ExtensionHandlerJavaPackage.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/extensions/ExtensionHandlerJavaPackage.java,v
  retrieving revision 1.11
  retrieving revision 1.11.10.1
  diff -u -r1.11 -r1.11.10.1
  --- ExtensionHandlerJavaPackage.java  28 Jul 2001 00:25:57 -0000      1.11
  +++ ExtensionHandlerJavaPackage.java  4 Oct 2002 09:24:45 -0000       
1.11.10.1
  @@ -87,7 +87,7 @@
    * <pre>
    *   xalan://partial.class.name
    *   xalan://
  - *   http://xml.apache.org/xslt/java (which is the same as xalan://)
  + *   http://xml.apache.org/xalan/java (which is the same as xalan://)
    * </pre>
    * However, we do not enforce this.  If the class name contains a
    * a /, we only use the part to the right of the rightmost slash.
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.18.10.1 +2 -1      
xml-xalan/java/src/org/apache/xalan/processor/ProcessorLRE.java
  
  Index: ProcessorLRE.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorLRE.java,v
  retrieving revision 1.18
  retrieving revision 1.18.10.1
  diff -u -r1.18 -r1.18.10.1
  --- ProcessorLRE.java 28 Jul 2001 00:25:57 -0000      1.18
  +++ ProcessorLRE.java 4 Oct 2002 09:24:45 -0000       1.18.10.1
  @@ -249,7 +249,8 @@
             isExtension = parentElem.containsExtensionElementURI(uri);
   
             if ((false == isExtension) && (null != uri)
  -              && uri.equals(Constants.S_BUILTIN_EXTENSIONS_URL))
  +              && (uri.equals(Constants.S_BUILTIN_EXTENSIONS_URL)
  +                  || uri.equals(Constants.S_BUILTIN_OLD_EXTENSIONS_URL)))
             {
               isComponentDecl = true;
             }
  
  
  
  1.14.10.1 +4 -2      
xml-xalan/java/src/org/apache/xalan/processor/XSLTElementDef.java
  
  Index: XSLTElementDef.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/XSLTElementDef.java,v
  retrieving revision 1.14
  retrieving revision 1.14.10.1
  diff -u -r1.14 -r1.14.10.1
  --- XSLTElementDef.java       30 Oct 2001 19:13:04 -0000      1.14
  +++ XSLTElementDef.java       4 Oct 2002 09:24:45 -0000       1.14.10.1
  @@ -100,7 +100,8 @@
             classObject);
       if ( (null != namespace)
       &&  (namespace.equals(Constants.S_XSLNAMESPACEURL)
  -        || namespace.equals(Constants.S_BUILTIN_EXTENSIONS_URL)) )
  +        || namespace.equals(Constants.S_BUILTIN_EXTENSIONS_URL)
  +        || namespace.equals(Constants.S_BUILTIN_OLD_EXTENSIONS_URL)))
       {
         schema.addAvailableElement(new QName(namespace, name));
         if(null != nameAlias)
  @@ -129,7 +130,8 @@
             classObject);
       if ( (null != namespace)
       &&  (namespace.equals(Constants.S_XSLNAMESPACEURL)
  -        || namespace.equals(Constants.S_BUILTIN_EXTENSIONS_URL)) )
  +        || namespace.equals(Constants.S_BUILTIN_EXTENSIONS_URL)
  +        || namespace.equals(Constants.S_BUILTIN_OLD_EXTENSIONS_URL)))
       {
         schema.addAvailableElement(new QName(namespace, name));
         if(null != nameAlias)
  
  
  
  1.23.10.3 +39 -19    
xml-xalan/java/src/org/apache/xalan/processor/XSLTSchema.java
  
  Index: XSLTSchema.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/XSLTSchema.java,v
  retrieving revision 1.23.10.2
  retrieving revision 1.23.10.3
  diff -u -r1.23.10.2 -r1.23.10.3
  --- XSLTSchema.java   18 Sep 2002 13:31:52 -0000      1.23.10.2
  +++ XSLTSchema.java   4 Oct 2002 09:24:45 -0000       1.23.10.3
  @@ -667,6 +667,21 @@
                                     new ProcessorInclude(),
                                     null /* class object */,
                                                  20, true);
  +    
  +    XSLTAttributeDef[] scriptAttrs = new XSLTAttributeDef[]{
  +                                         new XSLTAttributeDef(null, "lang", 
XSLTAttributeDef.T_NMTOKEN,
  +                                                                 true, 
false,XSLTAttributeDef.WARNING),
  +                                            new XSLTAttributeDef(null, 
"src", XSLTAttributeDef.T_URL, 
  +                                                              false, 
false,XSLTAttributeDef.WARNING)};
  +
  +    XSLTAttributeDef[] componentAttrs = new XSLTAttributeDef[]{ 
  +                                            new XSLTAttributeDef(null, 
"prefix", XSLTAttributeDef.T_NMTOKEN, 
  +                                                              true, 
false,XSLTAttributeDef.WARNING),
  +                                            new XSLTAttributeDef(null, 
"elements", XSLTAttributeDef.T_STRINGLIST, 
  +                                                              false, 
false,XSLTAttributeDef.WARNING),
  +                                            new XSLTAttributeDef(null, 
"functions", XSLTAttributeDef.T_STRINGLIST, 
  +                                                              false, 
false,XSLTAttributeDef.WARNING) };
  +
       XSLTElementDef[] topLevelElements = new XSLTElementDef[]
                                    {includeDef,
                                     importDef,
  @@ -810,26 +825,31 @@
                                                           
Constants.S_BUILTIN_EXTENSIONS_URL,
                                                           "script",
                                                           null /*alias */,
  -                                                    new XSLTElementDef[]{ 
  +                                                     new XSLTElementDef[]{ 
                                                           charData } /* 
elements */,
  -                                                        new 
XSLTAttributeDef[]{
  -                                                            new 
XSLTAttributeDef(
  -                                                                null,
  -                                                                "lang",
  -                                                                
XSLTAttributeDef.T_NMTOKEN,
  -                                                                true, 
false,XSLTAttributeDef.WARNING),
  -                                                            new 
XSLTAttributeDef(
  -                                                                null, "src", 
XSLTAttributeDef.T_URL, false, false,XSLTAttributeDef.WARNING) }, 
  -                                                                new 
ProcessorLRE(),
  -                                                                
ElemExtensionScript.class /* class object */, 20, true) },  // EMPTY
  -                                                            new 
XSLTAttributeDef[]{ 
  -                                                                new 
XSLTAttributeDef(
  -                                                                    null, 
"prefix", XSLTAttributeDef.T_NMTOKEN, true, false,XSLTAttributeDef.WARNING),
  -                                                                new 
XSLTAttributeDef(
  -                                                                    null, 
"elements", XSLTAttributeDef.T_STRINGLIST, false, 
false,XSLTAttributeDef.WARNING),
  -                                                                new 
XSLTAttributeDef(
  -                                                                    null, 
"functions", XSLTAttributeDef.T_STRINGLIST, false, 
false,XSLTAttributeDef.WARNING) }, 
  -                                                    new ProcessorLRE(), 
ElemExtensionDecl.class /* class object */),
  +                                                        scriptAttrs, 
  +                                                        new ProcessorLRE(),
  +                                                        
ElemExtensionScript.class /* class object */, 20, true) },  // EMPTY
  +                                           componentAttrs, 
  +                                           new ProcessorLRE(), 
ElemExtensionDecl.class /* class object */),
  +                                  new XSLTElementDef(
  +                                           this,
  +                                           
Constants.S_BUILTIN_OLD_EXTENSIONS_URL,
  +                                           "component",
  +                                           null /*alias */,
  +                                           new XSLTElementDef[]{
  +                                                    new XSLTElementDef(
  +                                                        this,
  +                                                        
Constants.S_BUILTIN_OLD_EXTENSIONS_URL,
  +                                                        "script",
  +                                                        null /*alias */,
  +                                                     new XSLTElementDef[]{ 
  +                                                        charData } /* 
elements */,
  +                                                        scriptAttrs, 
  +                                                        new ProcessorLRE(),
  +                                                        
ElemExtensionScript.class /* class object */, 20, true) },  // EMPTY
  +                                           componentAttrs, 
  +                                           new ProcessorLRE(), 
ElemExtensionDecl.class /* class object */),
                                     exsltFunction}/* exslt */;  //end of 
topevelElements
       
       XSLTAttributeDef excludeResultPrefixesAttr =
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.12.16.3 +9 -2      
xml-xalan/java/src/org/apache/xalan/templates/Constants.java
  
  Index: Constants.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/Constants.java,v
  retrieving revision 1.12.16.2
  retrieving revision 1.12.16.3
  diff -u -r1.12.16.2 -r1.12.16.3
  --- Constants.java    12 Sep 2002 16:07:32 -0000      1.12.16.2
  +++ Constants.java    4 Oct 2002 09:24:45 -0000       1.12.16.3
  @@ -102,12 +102,19 @@
        S_VENDORURL = "http://xml.apache.org";;
   
     /** S_BUILTIN_EXTENSIONS_URL is a mnemonic for the XML Namespace 
  -   *(http://xml.apache.org/xslt) predefined to signify Xalan's
  +   *(http://xml.apache.org/xalan) predefined to signify Xalan's
      * built-in XSLT Extensions. When used in stylesheets, this is often 
      * bound to the "xalan:" prefix.
      */
     public static final String 
  -    S_BUILTIN_EXTENSIONS_URL = "http://xml.apache.org/xslt";; 
  +    S_BUILTIN_EXTENSIONS_URL = "http://xml.apache.org/xalan";; 
  +
  +  /**
  +   * The old built-in extension url. It is still supported for
  +   * backward compatibility.
  +   */
  +  public static final String 
  +    S_BUILTIN_OLD_EXTENSIONS_URL = "http://xml.apache.org/xslt";; 
     
     /**
      * Xalan extension namespaces.
  
  
  
  1.48.2.2  +2 -1      
xml-xalan/java/src/org/apache/xalan/templates/ElemTemplateElement.java
  
  Index: ElemTemplateElement.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemTemplateElement.java,v
  retrieving revision 1.48.2.1
  retrieving revision 1.48.2.2
  diff -u -r1.48.2.1 -r1.48.2.2
  --- ElemTemplateElement.java  29 Jul 2002 00:01:19 -0000      1.48.2.1
  +++ ElemTemplateElement.java  4 Oct 2002 09:24:45 -0000       1.48.2.2
  @@ -1058,7 +1058,8 @@
       {
         if (uri.equals(Constants.S_XSLNAMESPACEURL)
                 || getStylesheet().containsExtensionElementURI(uri)
  -              || uri.equals(Constants.S_BUILTIN_EXTENSIONS_URL))
  +              || uri.equals(Constants.S_BUILTIN_EXTENSIONS_URL)
  +              || uri.equals(Constants.S_BUILTIN_OLD_EXTENSIONS_URL))
           return true;
   
         if (containsExcludeResultPrefix(prefix, uri))
  
  
  
  1.20.10.2 +14 -0     
xml-xalan/java/src/org/apache/xalan/templates/OutputProperties.java
  
  Index: OutputProperties.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/OutputProperties.java,v
  retrieving revision 1.20.10.1
  retrieving revision 1.20.10.2
  diff -u -r1.20.10.1 -r1.20.10.2
  --- OutputProperties.java     14 Sep 2002 10:53:24 -0000      1.20.10.1
  +++ OutputProperties.java     4 Oct 2002 09:24:45 -0000       1.20.10.2
  @@ -143,6 +143,14 @@
           "{"+Constants.S_BUILTIN_EXTENSIONS_URL+"}";
     
     /**
  +   * The old built-in extension namespace
  +   */
  +  static final String S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL=
  +        "{"+Constants.S_BUILTIN_OLD_EXTENSIONS_URL+"}";
  +  
  +  static final int S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL_LEN = 
S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL.length();
  +  
  +  /**
      * Fix up a string in an output properties file according to 
      * the rules of [EMAIL PROTECTED] #loadPropertiesFile}.
      * 
  @@ -418,6 +426,10 @@
       {
         setMethodDefaults(value);
       }
  +    
  +    if (key.startsWith(S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL))
  +      key = S_BUILTIN_EXTENSIONS_UNIVERSAL + 
key.substring(S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL_LEN);
  +    
       m_properties.put(key, value);
     }
   
  @@ -446,6 +458,8 @@
      */
     public String getProperty(String key)
     {
  +    if (key.startsWith(S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL))
  +      key = S_BUILTIN_EXTENSIONS_UNIVERSAL + 
key.substring(S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL_LEN);
       return m_properties.getProperty(key);
     }
   
  
  
  
  1.8.10.1  +6 -6      
xml-xalan/java/src/org/apache/xalan/templates/output_html.properties
  
  Index: output_html.properties
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/output_html.properties,v
  retrieving revision 1.8
  retrieving revision 1.8.10.1
  diff -u -r1.8 -r1.8.10.1
  --- output_html.properties    10 Oct 2001 18:44:34 -0000      1.8
  +++ output_html.properties    4 Oct 2002 09:24:45 -0000       1.8.10.1
  @@ -13,13 +13,13 @@
   # assigning a xalan namespace.  For example:
   # <xsl:stylesheet version="1.0"
   #          xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  -#          xmlns:xalan="http://xml.apache.org/xslt";>
  +#          xmlns:xalan="http://xml.apache.org/xalan";>
   #  <xsl:output method="html" encoding="UTF-8"
   #              xalan:content-handler="MyContentHandler"/>
   #  ...
   # Note that the colon after the protocol needs to be escaped.
  -{http\u003a//xml.apache.org/xslt}indent-amount=0
  
-{http\u003a//xml.apache.org/xslt}content-handler=org.apache.xalan.serialize.SerializerToHTML
  
-{http\u003a//xml.apache.org/xslt}entities=org/apache/xalan/serialize/HTMLEntities.res
  -{http\u003a//xml.apache.org/xslt}use-url-escaping=yes
  -{http\u003a//xml.apache.org/xslt}omit-meta-tag=no
  +{http\u003a//xml.apache.org/xalan}indent-amount=0
  
+{http\u003a//xml.apache.org/xalan}content-handler=org.apache.xalan.serialize.SerializerToHTML
  
+{http\u003a//xml.apache.org/xalan}entities=org/apache/xalan/serialize/HTMLEntities.res
  +{http\u003a//xml.apache.org/xalan}use-url-escaping=yes
  +{http\u003a//xml.apache.org/xalan}omit-meta-tag=no
  
  
  
  1.4.16.1  +2 -2      
xml-xalan/java/src/org/apache/xalan/templates/output_text.properties
  
  Index: output_text.properties
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/output_text.properties,v
  retrieving revision 1.4
  retrieving revision 1.4.16.1
  diff -u -r1.4 -r1.4.16.1
  --- output_text.properties    2 Jan 2001 03:36:47 -0000       1.4
  +++ output_text.properties    4 Oct 2002 09:24:45 -0000       1.4.16.1
  @@ -10,9 +10,9 @@
   # assigning a xalan namespace.  For example:
   # <xsl:stylesheet version="1.0"
   #          xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  -#          xmlns:xalan="http://xml.apache.org/xslt";>
  +#          xmlns:xalan="http://xml.apache.org/xalan";>
   #  <xsl:output method="html" encoding="UTF-8"
   #              xalan:content-handler="MyContentHandler"/>
   #  ...
   # Note that the colon after the protocol needs to be escaped.
  
-{http\u003a//xml.apache.org/xslt}content-handler=org.apache.xalan.serialize.SerializerToText
  \ No newline at end of file
  
+{http\u003a//xml.apache.org/xalan}content-handler=org.apache.xalan.serialize.SerializerToText
  \ No newline at end of file
  
  
  
  1.3.10.1  +4 -4      
xml-xalan/java/src/org/apache/xalan/templates/output_xml.properties
  
  Index: output_xml.properties
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/output_xml.properties,v
  retrieving revision 1.3
  retrieving revision 1.3.10.1
  diff -u -r1.3 -r1.3.10.1
  --- output_xml.properties     10 Oct 2001 18:44:34 -0000      1.3
  +++ output_xml.properties     4 Oct 2002 09:24:45 -0000       1.3.10.1
  @@ -16,12 +16,12 @@
   # assigning a xalan namespace.  For example:
   # <xsl:stylesheet version="1.0"
   #          xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  -#          xmlns:xalan="http://xml.apache.org/xslt";>
  +#          xmlns:xalan="http://xml.apache.org/xalan";>
   #  <xsl:output method="html" encoding="UTF-8"
   #              xalan:content-handler="MyContentHandler"/>
   #  ...
   # Note that the colon after the protocol needs to be escaped.
  -{http\u003a//xml.apache.org/xslt}indent-amount=0
  
-{http\u003a//xml.apache.org/xslt}content-handler=org.apache.xalan.serialize.SerializerToXML
  
-{http\u003a//xml.apache.org/xslt}entities=org/apache/xalan/serialize/XMLEntities.res
  +{http\u003a//xml.apache.org/xalan}indent-amount=0
  
+{http\u003a//xml.apache.org/xalan}content-handler=org.apache.xalan.serialize.SerializerToXML
  
+{http\u003a//xml.apache.org/xalan}entities=org/apache/xalan/serialize/XMLEntities.res
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.47.6.3  +201 -19   xml-xalan/java/src/org/apache/xalan/xslt/Process.java
  
  Index: Process.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xslt/Process.java,v
  retrieving revision 1.47.6.2
  retrieving revision 1.47.6.3
  diff -u -r1.47.6.2 -r1.47.6.3
  --- Process.java      20 Sep 2002 22:11:57 -0000      1.47.6.2
  +++ Process.java      4 Oct 2002 09:24:46 -0000       1.47.6.3
  @@ -124,21 +124,14 @@
     protected static void printArgOptions(ResourceBundle resbundle)
     {
       System.out.println(resbundle.getString("xslProc_option"));  //"xslproc 
options: ");
  -    System.out.println(resbundle.getString("optionIN"));  //"    -IN 
inputXMLURL");
  +    System.out.println("\n\t\t\t" + 
resbundle.getString("xslProc_common_options") + "\n");
       System.out.println(resbundle.getString("optionXSLTC"));  //"    [-XSLTC 
(use XSLTC for transformation)]
  +    System.out.println(resbundle.getString("optionIN"));  //"    [-IN 
inputXMLURL]");
       System.out.println(resbundle.getString("optionXSL"));  //"   [-XSL 
XSLTransformationURL]");
       System.out.println(resbundle.getString("optionOUT"));  //"   [-OUT 
outputFileName]");
   
       // System.out.println(resbundle.getString("optionE")); //"   [-E (Do not 
expand entity refs)]");
       System.out.println(resbundle.getString("optionV"));  //"   [-V (Version 
info)]");
  -    System.out.println(resbundle.getString("optionQC"));  //"   [-QC (Quiet 
Pattern Conflicts Warnings)]");
  -
  -    // System.out.println(resbundle.getString("optionQ"));  //"   [-Q  
(Quiet Mode)]"); // sc 28-Feb-01 commented out
  -    System.out.println(resbundle.getString("optionTT"));  //"   [-TT (Trace 
the templates as they are being called.)]");
  -    System.out.println(resbundle.getString("optionTG"));  //"   [-TG (Trace 
each generation event.)]");
  -    System.out.println(resbundle.getString("optionTS"));  //"   [-TS (Trace 
each selection event.)]");
  -    System.out.println(resbundle.getString("optionTTC"));  //"   [-TTC 
(Trace the template children as they are being processed.)]");
  -    System.out.println(resbundle.getString("optionTCLASS"));  //"   [-TCLASS 
(TraceListener class for trace extensions.)]");
   
       // System.out.println(resbundle.getString("optionVALIDATE")); //"   
[-VALIDATE (Set whether validation occurs.  Validation is off by default.)]");
       System.out.println(resbundle.getString("optionEDUMP"));  //"   [-EDUMP 
{optional filename} (Do stackdump on error.)]");
  @@ -146,17 +139,39 @@
       System.out.println(resbundle.getString("optionTEXT"));  //"   [-TEXT 
(Use simple Text formatter.)]");
       System.out.println(resbundle.getString("optionHTML"));  //"   [-HTML 
(Use HTML formatter.)]");
       System.out.println(resbundle.getString("optionPARAM"));  //"   [-PARAM 
name expression (Set a stylesheet parameter)]");
  -    System.out.println(resbundle.getString("optionLINENUMBERS")); //"   [-L 
use line numbers]"
       
       System.out.println(resbundle.getString("optionMEDIA"));
       System.out.println(resbundle.getString("optionFLAVOR"));
       System.out.println(resbundle.getString("optionDIAG"));
  -    System.out.println(resbundle.getString("optionURIRESOLVER"));  //"   
[-URIRESOLVER full class name (URIResolver to be used to resolve URIs)]");
  +    System.out.println(resbundle.getString("optionURIRESOLVER"));  //"   
[-URIRESOLVER full class name (URIResolver to be used to resolve URIs)]");    
       System.out.println(resbundle.getString("optionENTITYRESOLVER"));  //"   
[-ENTITYRESOLVER full class name (EntityResolver to be used to resolve 
entities)]");
  +    waitForReturnKey(resbundle);
       System.out.println(resbundle.getString("optionCONTENTHANDLER"));  //"   
[-CONTENTHANDLER full class name (ContentHandler to be used to serialize 
output)]");
  +    
  +    System.out.println("\n\t\t\t" + 
resbundle.getString("xslProc_xalan_options") + "\n");
  +    
  +    System.out.println(resbundle.getString("optionQC"));  //"   [-QC (Quiet 
Pattern Conflicts Warnings)]");
  +
  +    // System.out.println(resbundle.getString("optionQ"));  //"   [-Q  
(Quiet Mode)]"); // sc 28-Feb-01 commented out
  +    System.out.println(resbundle.getString("optionTT"));  //"   [-TT (Trace 
the templates as they are being called.)]");
  +    System.out.println(resbundle.getString("optionTG"));  //"   [-TG (Trace 
each generation event.)]");
  +    System.out.println(resbundle.getString("optionTS"));  //"   [-TS (Trace 
each selection event.)]");
  +    System.out.println(resbundle.getString("optionTTC"));  //"   [-TTC 
(Trace the template children as they are being processed.)]");
  +    System.out.println(resbundle.getString("optionTCLASS"));  //"   [-TCLASS 
(TraceListener class for trace extensions.)]");
  +    System.out.println(resbundle.getString("optionLINENUMBERS")); //"   [-L 
use line numbers]"
       System.out.println(resbundle.getString("optionINCREMENTAL"));
       System.out.println(resbundle.getString("optionNOOPTIMIMIZE"));
       System.out.println(resbundle.getString("optionRL"));
  +        
  +    System.out.println("\n\t\t\t" + 
resbundle.getString("xslProc_xsltc_options") + "\n");
  +    System.out.println(resbundle.getString("optionXO"));
  +    System.out.println(resbundle.getString("optionXD"));
  +    waitForReturnKey(resbundle);    
  +    System.out.println(resbundle.getString("optionXJ"));
  +    System.out.println(resbundle.getString("optionXP"));
  +    System.out.println(resbundle.getString("optionXN"));
  +    System.out.println(resbundle.getString("optionXX"));
  +    System.out.println(resbundle.getString("optionXT"));
     }
     
     /**
  @@ -333,7 +348,7 @@
           }
           else if ("-IN".equalsIgnoreCase(argv[i]))
           {
  -          if (i + 1 < argv.length)
  +          if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-')
               inFileName = argv[++i];
             else
               System.err.println(
  @@ -353,7 +368,7 @@
           }
           else if ("-OUT".equalsIgnoreCase(argv[i]))
           {
  -          if (i + 1 < argv.length)
  +          if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-')
               outFileName = argv[++i];
             else
               System.err.println(
  @@ -363,7 +378,7 @@
           }
           else if ("-XSL".equalsIgnoreCase(argv[i]))
           {
  -          if (i + 1 < argv.length)
  +          if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-')
               xslFileName = argv[++i];
             else
               System.err.println(
  @@ -578,18 +593,145 @@
             }
             else
             {
  -            if (i + 1 < argv.length)
  +            if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-')
                i++;
                
               printInvalidXSLTCOption("-RL");
             }
           }
  -
  +        // Generate the translet class and optionally specify the name
  +        // of the translet class.
  +        else if ("-XO".equalsIgnoreCase(argv[i]))
  +        {
  +          if (useXSLTC)
  +          {
  +            if (i + 1 < argv.length && argv[i+1].charAt(0) != '-')
  +            {
  +              tfactory.setAttribute("generate-translet", "true");
  +              tfactory.setAttribute("translet-name", argv[++i]);
  +            }
  +            else
  +              tfactory.setAttribute("generate-translet", "true");
  +          }
  +          else
  +          {
  +            if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-')
  +             i++;
  +            printInvalidXalanOption("-XO");
  +          }
  +        }
  +        // Specify the destination directory for the translet classes.
  +        else if ("-XD".equalsIgnoreCase(argv[i]))
  +        {
  +          if (useXSLTC)
  +          {
  +            if (i + 1 < argv.length && argv[i+1].charAt(0) != '-')
  +              tfactory.setAttribute("destination-directory", argv[++i]);
  +            else
  +              System.err.println(
  +                XSLMessages.createMessage(
  +                  XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION,
  +                  new Object[]{ "-XD" }));  //"Missing argument for);
  +            
  +          }          
  +          else
  +          {
  +            if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-')
  +             i++;
  +             
  +            printInvalidXalanOption("-XD");
  +          }
  +        }
  +        // Specify the jar file name which the translet classes are packaged 
into.
  +        else if ("-XJ".equalsIgnoreCase(argv[i]))
  +        {
  +          if (useXSLTC)
  +          {
  +            if (i + 1 < argv.length && argv[i+1].charAt(0) != '-')
  +            {
  +              tfactory.setAttribute("generate-translet", "true");
  +              tfactory.setAttribute("jar-name", argv[++i]);
  +            }
  +            else
  +              System.err.println(
  +                XSLMessages.createMessage(
  +                  XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION,
  +                  new Object[]{ "-XJ" }));  //"Missing argument for);
  +          }                    
  +          else
  +          {
  +            if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-')
  +             i++;
  +             
  +            printInvalidXalanOption("-XJ");
  +          }
  +        
  +        }
  +        // Specify the package name prefix for the generated translet 
classes.
  +        else if ("-XP".equalsIgnoreCase(argv[i]))
  +        {
  +          if (useXSLTC)
  +          {
  +            if (i + 1 < argv.length && argv[i+1].charAt(0) != '-')
  +              tfactory.setAttribute("package-name", argv[++i]);
  +            else
  +              System.err.println(
  +                XSLMessages.createMessage(
  +                  XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION,
  +                  new Object[]{ "-XP" }));  //"Missing argument for);
  +          }                              
  +          else
  +          {
  +            if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-')
  +             i++;
  +             
  +            printInvalidXalanOption("-XP");
  +          }
  +        
  +        }
  +        // Enable template inlining.
  +        else if ("-XN".equalsIgnoreCase(argv[i]))
  +        {
  +          if (useXSLTC)
  +          {
  +            tfactory.setAttribute("enable-inlining", "true");
  +          }                                        
  +          else
  +            printInvalidXalanOption("-XN");        
  +        }
  +        // Turns on additional debugging message output
  +        else if ("-XX".equalsIgnoreCase(argv[i]))
  +        {
  +          if (useXSLTC)
  +          {
  +            tfactory.setAttribute("debug", "true");
  +          }                                        
  +          else
  +            printInvalidXalanOption("-XX");        
  +        }
  +        // Create the Transformer from the translet if the translet class is 
newer
  +        // than the stylesheet.
  +        else if ("-XT".equalsIgnoreCase(argv[i]))
  +        {
  +          if (useXSLTC)
  +          {
  +            tfactory.setAttribute("auto-translet", "true");
  +          }                                        
  +          else
  +            printInvalidXalanOption("-XT");        
  +        }
           else
             System.err.println(
               XSLMessages.createMessage(
                 XSLTErrorResources.ER_INVALID_OPTION, new Object[]{ argv[i] 
}));  //"Invalid argument:);
         }
  +      
  +      // Print usage instructions if no xml and xsl file is specified in the 
command line
  +      if (inFileName == null && xslFileName == null)
  +      {
  +        System.err.println(resbundle.getString("xslProc_no_input"));
  +        doExit(-1);
  +      }
   
         // Note that there are usage cases for calling us without a -IN arg
         // The main XSL transformation occurs here!
  @@ -688,9 +830,9 @@
               transformer.setOutputProperty(OutputKeys.METHOD, outputType);
             }
   
  -          if (transformer instanceof TransformerImpl)
  +          if (transformer instanceof 
org.apache.xalan.transformer.TransformerImpl)
             {
  -            TransformerImpl impl = ((TransformerImpl) transformer);
  +            org.apache.xalan.transformer.TransformerImpl impl = 
(org.apache.xalan.transformer.TransformerImpl)transformer;
               TraceManager tm = impl.getTraceManager();
   
               if (null != tracer)
  @@ -917,6 +1059,19 @@
                 XSLTErrorResources.ER_NOT_SUCCESSFUL, null));  //"XSL Process 
was not successful.");
             doExit(-1);
           }
  +        
  +     // close output streams
  +     if (null != outFileName && strResult!=null)
  +     {
  +       java.io.OutputStream out = strResult.getOutputStream();
  +       java.io.Writer writer = strResult.getWriter();
  +       try
  +       {
  +                 if (out != null) out.close();
  +                 if (writer != null) writer.close();
  +       }
  +       catch(java.io.IOException ie) {}
  +     }        
   
           long stop = System.currentTimeMillis();
           long millisecondsDuration = stop - start;
  @@ -993,10 +1148,37 @@
     }
     
     /**
  +   * Wait for a return key to continue
  +   * 
  +   * @param resbundle The resource bundle
  +   */
  +  private static void waitForReturnKey(ResourceBundle resbundle)
  +  {
  +    System.out.println(resbundle.getString("xslProc_return_to_continue"));
  +    try
  +    {
  +      while (System.in.read() != '\n');
  +    }
  +    catch (java.io.IOException e) { }  
  +  }
  +  
  +  /**
      * Print a message if an option cannot be used with -XSLTC.
  +   *
  +   * @param option The option String
      */
     private static void printInvalidXSLTCOption(String option)
     {
  -    System.err.println(XSLMessages.createMessage("invalid_xsltc_option", new 
Object[]{option}));
  +    
System.err.println(XSLMessages.createMessage("xslProc_invalid_xsltc_option", 
new Object[]{option}));
  +  }
  +  
  +  /**
  +   * Print a message if an option can only be used with -XSLTC.
  +   *
  +   * @param option The option String
  +   */
  +  private static void printInvalidXalanOption(String option)
  +  {
  +    
System.err.println(XSLMessages.createMessage("xslProc_invalid_xalan_option", 
new Object[]{option}));
     }
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.35.6.5  +45 -6     
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/XSLTC.java
  
  Index: XSLTC.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/XSLTC.java,v
  retrieving revision 1.35.6.4
  retrieving revision 1.35.6.5
  diff -u -r1.35.6.4 -r1.35.6.5
  --- XSLTC.java        18 Sep 2002 15:56:48 -0000      1.35.6.4
  +++ XSLTC.java        4 Oct 2002 09:24:46 -0000       1.35.6.5
  @@ -132,6 +132,9 @@
       public static final int JAR_OUTPUT         = 1;
       public static final int BYTEARRAY_OUTPUT   = 2;
       public static final int CLASSLOADER_OUTPUT = 3;
  +    public static final int BYTEARRAY_AND_FILE_OUTPUT = 4;
  +    public static final int BYTEARRAY_AND_JAR_OUTPUT  = 5;
  +    
   
       // Compiler options (passed from command line or XSLTC client)
       private boolean _debug = false;      // -x
  @@ -142,6 +145,7 @@
       private int     _outputType = FILE_OUTPUT; // by default
   
       private Vector  _classes;
  +    private Vector  _bcelClasses;
       private boolean _callsNodeset = false;
       private boolean _multiDocument = false;
   
  @@ -188,6 +192,7 @@
        reset();
        _reader = null;
        _classes = new Vector();
  +     _bcelClasses = new Vector();
       }
       
       /**
  @@ -423,15 +428,27 @@
        * set of byte arrays. One byte array for each generated class.
        * @param name The name of the translet class to generate
        * @param input An InputSource that will pass in the stylesheet contents
  +     * @param outputType The output type
        * @return JVM bytecodes that represent translet class definition
        */
  -    public byte[][] compile(String name, InputSource input) {
  -     _outputType = BYTEARRAY_OUTPUT;
  +    public byte[][] compile(String name, InputSource input, int outputType) {
  +     _outputType = outputType;
        if (compile(input, name))
            return getBytecodes();
        else
            return null;
       }
  +    
  +    /**
  +     * Compiles a stylesheet pointed to by a URL. The result is put in a
  +     * set of byte arrays. One byte array for each generated class.
  +     * @param name The name of the translet class to generate
  +     * @param input An InputSource that will pass in the stylesheet contents
  +     * @return JVM bytecodes that represent translet class definition
  +     */
  +    public byte[][] compile(String name, InputSource input) {
  +        return compile(name, input, BYTEARRAY_OUTPUT);
  +    }    
   
       /**
        * Set the XMLReader to use for parsing the next input stylesheet
  @@ -698,6 +715,19 @@
       }
      
       public void dumpClass(JavaClass clazz) {
  +     
  +     if (_outputType == FILE_OUTPUT || 
  +         _outputType == BYTEARRAY_AND_FILE_OUTPUT) 
  +     {
  +         File outFile = getOutputFile(clazz.getClassName());
  +         String parentDir = outFile.getParent();
  +         if (parentDir != null) {
  +             File parentFile = new File(parentDir);
  +             if (!parentFile.exists())
  +                 parentFile.mkdirs();
  +         }
  +     }
  +     
        try {
            switch (_outputType) {
            case FILE_OUTPUT:
  @@ -707,13 +737,22 @@
                            getOutputFile(clazz.getClassName()))));
                break;
            case JAR_OUTPUT:
  -             _classes.addElement(clazz);      
  +             _bcelClasses.addElement(clazz);  
                break;
            case BYTEARRAY_OUTPUT:
  +         case BYTEARRAY_AND_FILE_OUTPUT:
  +         case BYTEARRAY_AND_JAR_OUTPUT:
            case CLASSLOADER_OUTPUT:
                ByteArrayOutputStream out = new ByteArrayOutputStream(2048);
                clazz.dump(out);
                _classes.addElement(out.toByteArray());
  +             
  +             if (_outputType == BYTEARRAY_AND_FILE_OUTPUT)
  +               clazz.dump(new BufferedOutputStream(
  +                     new 
FileOutputStream(getOutputFile(clazz.getClassName()))));
  +             else if (_outputType == BYTEARRAY_AND_JAR_OUTPUT)
  +               _bcelClasses.addElement(clazz);
  +               
                break;
            }
        }
  @@ -740,7 +779,7 @@
   
        final Map map = manifest.getEntries();
        // create manifest
  -     Enumeration classes = _classes.elements();
  +     Enumeration classes = _bcelClasses.elements();
        final String now = (new Date()).toString();
        final java.util.jar.Attributes.Name dateAttr = 
            new java.util.jar.Attributes.Name("Date");
  @@ -755,7 +794,7 @@
        final File jarFile = new File(_destDir, _jarFileName);
        final JarOutputStream jos =
            new JarOutputStream(new FileOutputStream(jarFile), manifest);
  -     classes = _classes.elements();
  +     classes = _bcelClasses.elements();
        while (classes.hasMoreElements()) {
            final JavaClass clazz = (JavaClass)classes.nextElement();
            final String className = clazz.getClassName().replace('.','/');
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.5.10.4  +43 -9     
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/ErrorMessages.java
  
  Index: ErrorMessages.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/ErrorMessages.java,v
  retrieving revision 1.5.10.3
  retrieving revision 1.5.10.4
  diff -u -r1.5.10.3 -r1.5.10.4
  --- ErrorMessages.java        27 Sep 2002 21:54:38 -0000      1.5.10.3
  +++ ErrorMessages.java        4 Oct 2002 09:24:46 -0000       1.5.10.4
  @@ -632,7 +632,7 @@
         * Note to translators:  "setResult()" and "startDocument()" are Java
         * method names that should not be translated.
         */
  -     //JAXP_SET_RESULT_ERROR
  +     //JAXP_SET_RESULT_ERR
        "setResult() must be called prior to startDocument().",
   
        /*
  @@ -692,7 +692,12 @@
   
        /*
         * Note to translators:  This message contains usage information for a
  -      * means of invoking XSLTC from the command-line.
  +      * means of invoking XSLTC from the command-line.  The message is
  +         * formatted for presentation in English.  The strings <output>,
  +         * <directory>, etc. indicate user-specified argument values, and can
  +         * be translated - the argument <package> refers to a Java package, 
so
  +         * it should be handled in the same way the term is handled for JDK
  +         * documentation.
         */
        //COMPILE_USAGE_STR
        "SYNOPSIS\n"+
  @@ -720,7 +725,12 @@
   
        /*
         * Note to translators:  This message contains usage information for a
  -      * means of invoking XSLTC from the command-line.
  +      * means of invoking XSLTC from the command-line.  The message is
  +         * formatted for presentation in English.  The strings <jarfile>,
  +         * <document>, etc. indicate user-specified argument values, and can
  +         * be translated - the argument <class> refers to a Java class, so it
  +         * should be handled in the same way the term is handled for JDK
  +         * documentation.
         */
        //TRANSFORM_USAGE_STR
        "SYNOPSIS \n"+
  @@ -796,7 +806,7 @@
         * required in a particular context.  However, the location of the
         * problematic expression is unknown.
         */
  -     //TYPE_CHECK_LOC_UNK_ERR
  +     //TYPE_CHECK_UNK_LOC_ERR
        "Error checking type of an expression at an unknown location.",
   
        /*
  @@ -816,7 +826,8 @@
        /*
         * Note to translators:  This message is used to indicate the severity
         * of another message.  The substitution text contains two error
  -      * messages.
  +      * messages.  The spacing before the second substitution text indents
  +         * it the same amount as the first in English.
         */
        //WARNING_PLUS_WRAPPED_MSG
        "WARNING:  ''{0}''\n       :{1}",
  @@ -831,7 +842,8 @@
        /*
         * Note to translators:  This message is used to indicate the severity
         * of another message.  The substitution text contains two error
  -      * messages.
  +      * messages.  The spacing before the second substitution text indents
  +         * it the same amount as the first in English.
         */
        //FATAL_ERR_PLUS_WRAPPED_MSG
        "FATAL ERROR:  ''{0}''\n           :{1}",
  @@ -846,7 +858,8 @@
        /*
         * Note to translators:  This message is used to indicate the severity
         * of another message.  The substitution text contains two error
  -      * messages.
  +      * messages.  The spacing before the second substitution text indents
  +         * it the same amount as the first in English.
         */
        //ERROR_PLUS_WRAPPED_MSG
        "ERROR:  ''{0}''\n     :{1}",
  @@ -856,7 +869,28 @@
            * of another message.  The substitution text is an error message.
         */
        //ERROR_MSG
  -     "ERROR:  ''{0}''"
  +     "ERROR:  ''{0}''",
  +     
  +     /*
  +      * Note to translators:  The substitution text is the name of a class.
  +      */
  +     //TRANSFORM_WITH_TRANSLET_STR
  +     "Transform using translet ''{0}'' ",
  +
  +     /*
  +      * Note to translators:  The first substitution is the name of a class,
  +         * while the second substitution is the name of a jar file.
  +      */
  +     //TRANSFORM_WITH_JAR_STR
  +     "Transform using translet ''{0}'' from jar file ''{1}''",
  +
  +        /*
  +      * Note to translators:  "TransformerFactory" is the name of a Java
  +         * interface and must not be translated.  The substitution text is
  +         * the name of the class that could not be instantiated.
  +      */
  +        //COULD_NOT_CREATE_TRANS_FACT
  +        "Could not create an instance of the TransformerFactory class 
''{0}''."
       };
   
       private static Vector _keys;
  
  
  
  1.12.10.3 +4 -2      
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/ErrorMsg.java
  
  Index: ErrorMsg.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/ErrorMsg.java,v
  retrieving revision 1.12.10.2
  retrieving revision 1.12.10.3
  diff -u -r1.12.10.2 -r1.12.10.3
  --- ErrorMsg.java     27 Sep 2002 21:54:38 -0000      1.12.10.2
  +++ ErrorMsg.java     4 Oct 2002 09:24:46 -0000       1.12.10.3
  @@ -178,7 +178,9 @@
       public static final int FATAL_ERR_MSG               = 86;
       public static final int ERROR_PLUS_WRAPPED_MSG      = 87;
       public static final int ERROR_MSG                   = 88;
  -
  +    public static final int TRANSFORM_WITH_TRANSLET_STR = 89;
  +    public static final int TRANSFORM_WITH_JAR_STR      = 90;
  +    
       // All error messages are localized and are stored in resource bundles.
       // This array and the following 4 strings are read from that bundle.
       private static String[] _errorMessages;
  
  
  
  1.5.2.2   +13 -4     
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/Util.java
  
  Index: Util.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/Util.java,v
  retrieving revision 1.5.2.1
  retrieving revision 1.5.2.2
  diff -u -r1.5.2.1 -r1.5.2.2
  --- Util.java 29 Jul 2002 00:01:26 -0000      1.5.2.1
  +++ Util.java 4 Oct 2002 09:24:46 -0000       1.5.2.2
  @@ -86,11 +86,20 @@
        * files.
        */
       public static String baseName(String name) {
  -     int index = name.lastIndexOf('/');
  +     int index = name.lastIndexOf('\\');
        if (index < 0) {
  -         index = name.lastIndexOf('\\');
  +         index = name.lastIndexOf('/');
  +     }
  +     
  +     if (index >= 0)
  +         return name.substring(index + 1);
  +     else {
  +         int lastColonIndex = name.lastIndexOf(':');
  +         if (lastColonIndex > 0)
  +             return name.substring(lastColonIndex + 1);
  +         else
  +             return name;
        }
  -     return name.substring(index + 1);
       }
   
       /**
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.35.2.8  +5 -1      
xml-xalan/java/src/org/apache/xalan/xsltc/runtime/BasisLibrary.java
  
  Index: BasisLibrary.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/runtime/BasisLibrary.java,v
  retrieving revision 1.35.2.7
  retrieving revision 1.35.2.8
  diff -u -r1.35.2.7 -r1.35.2.8
  --- BasisLibrary.java 27 Sep 2002 21:54:39 -0000      1.35.2.7
  +++ BasisLibrary.java 4 Oct 2002 09:24:46 -0000       1.35.2.8
  @@ -906,6 +906,10 @@
   
       public static String formatNumber(double number, String pattern,
                                      DecimalFormat formatter) {
  +        // bugzilla fix 12813 
  +     if (formatter == null) {
  +         formatter = defaultFormatter;
  +     }
        try {
            StringBuffer result = new StringBuffer();
            if (pattern != defaultPattern) {
  
  
  
  1.1.10.2  +10 -3     
xml-xalan/java/src/org/apache/xalan/xsltc/runtime/ErrorMessages.java
  
  Index: ErrorMessages.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/runtime/ErrorMessages.java,v
  retrieving revision 1.1.10.1
  retrieving revision 1.1.10.2
  diff -u -r1.1.10.1 -r1.1.10.2
  --- ErrorMessages.java        27 Sep 2002 21:54:39 -0000      1.1.10.1
  +++ ErrorMessages.java        4 Oct 2002 09:24:46 -0000       1.1.10.2
  @@ -212,7 +212,7 @@
   
        /*
         * Note to translators:  As with the preceding message, a namespace
  -      * declaration has the form of a namespace and is only permitted to
  +      * declaration has the form of an attribute and is only permitted to
         * appear on an element.  The substitution text {0} is the namespace
         * prefix and {1} is the URI that was being used in the erroneous
         * namespace declaration.
  @@ -251,7 +251,14 @@
         * declarations.
         */
           // NAMESPACES_SUPPORT_ERR
  -        "The SAX parser you are using does not have support for XML 
Namespaces."
  +        "The SAX parser you are using does not have support for XML 
Namespaces.",
  +
  +        /*
  +         * Note to translators:  The substitution text is the URI that was in
  +         * error.
  +         */
  +        // CANT_RESOLVE_RELATIVE_URI_ERR
  +        "Could not resolve the URI reference ''{0}''."
       };
   
       private static Vector _keys;
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.5.2.3   +5 -2      
xml-xalan/java/src/org/apache/xalan/xsltc/trax/TemplatesHandlerImpl.java
  
  Index: TemplatesHandlerImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/trax/TemplatesHandlerImpl.java,v
  retrieving revision 1.5.2.2
  retrieving revision 1.5.2.3
  diff -u -r1.5.2.2 -r1.5.2.3
  --- TemplatesHandlerImpl.java 13 Aug 2002 21:21:14 -0000      1.5.2.2
  +++ TemplatesHandlerImpl.java 4 Oct 2002 09:24:46 -0000       1.5.2.3
  @@ -170,9 +170,12 @@
            }
   
            // Set the translet class name if not already set
  -         String transletName = TransformerFactoryImpl._defaultTransletName;
  +         String transletName = null;
            if (_systemId != null) {
                transletName = Util.baseName(_systemId);
  +         }
  +         else {
  +             transletName = (String)_tfactory.getAttribute("translet-name");
            }
            xsltc.setClassName(transletName);
   
  
  
  
  1.34.2.6  +479 -5    
xml-xalan/java/src/org/apache/xalan/xsltc/trax/TransformerFactoryImpl.java
  
  Index: TransformerFactoryImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/trax/TransformerFactoryImpl.java,v
  retrieving revision 1.34.2.5
  retrieving revision 1.34.2.6
  diff -u -r1.34.2.5 -r1.34.2.6
  --- TransformerFactoryImpl.java       27 Sep 2002 21:54:40 -0000      1.34.2.5
  +++ TransformerFactoryImpl.java       4 Oct 2002 09:24:46 -0000       1.34.2.6
  @@ -65,14 +65,21 @@
   package org.apache.xalan.xsltc.trax;
   
   import java.io.File;
  +import java.io.IOException;
  +import java.io.FileNotFoundException;
   import java.io.Reader;
   import java.io.InputStream;
  +import java.io.FileInputStream;
   import java.io.ByteArrayInputStream;
  +import java.io.FilenameFilter;
   import java.net.URL;
   import java.net.MalformedURLException;
   import java.util.Vector;
   import java.util.Hashtable;
   import java.util.Properties;
  +import java.util.Enumeration;
  +import java.util.zip.ZipFile;
  +import java.util.zip.ZipEntry;
   
   import javax.xml.transform.*;
   import javax.xml.transform.sax.*;
  @@ -118,7 +125,27 @@
        * compared to the rest of his bulk, waved helplessly before his eyes.
        * "What has happened to me?", he thought. It was no dream....
        */
  -    protected static String _defaultTransletName = "GregorSamsa";
  +    protected static String DEFAULT_TRANSLET_NAME = "GregorSamsa";
  +    
  +    /**
  +     * The class name of the translet
  +     */
  +    private String _transletName = DEFAULT_TRANSLET_NAME;
  +    
  +    /**
  +     * The destination directory for the translet
  +     */
  +    private String _destinationDirectory = null;
  +    
  +    /**
  +     * The package name prefix for all generated translet classes
  +     */
  +    private String _packageName = null;
  +    
  +    /**
  +     * The jar file name which the translet classes are packaged into
  +     */
  +    private String _jarFileName = null;
   
       /**
        * This Hashtable is used to store parameters for locating
  @@ -156,6 +183,19 @@
        * Set to <code>true</code> when templates are inlined.
        */
       private boolean _enableInlining = false;
  +    
  +    /**
  +     * Set to <code>true</code> when we want to generate 
  +     * translet classes from the stylesheet.
  +     */
  +    private boolean _generateTranslet = false;
  +    
  +    /**
  +     * If this is set to <code>true</code>, we attempt to use translet 
classes for 
  +     * transformation if possible without compiling the stylesheet. The 
translet class
  +     * is only used if its timestamp is newer than the timestamp of the 
stylesheet.
  +     */
  +    private boolean _autoTranslet = false;
   
       /**
        * Number of indent spaces when indentation is turned on.
  @@ -217,7 +257,13 @@
       { 
        // Return value for attribute 'translet-name'
        if (name.equals("translet-name")) {
  -         return _defaultTransletName;
  +         return _transletName;
  +     }
  +     else if (name.equals("generate-translet")) {
  +         return new Boolean(_generateTranslet);
  +     }
  +     else if (name.equals("auto-translet")) {
  +         return new Boolean(_autoTranslet);
        }
   
        // Throw an exception for all other attributes
  @@ -239,9 +285,41 @@
        // Set the default translet name (ie. class name), which will be used
        // for translets that cannot be given a name from their system-id.
        if (name.equals("translet-name") && value instanceof String) {
  -         _defaultTransletName = (String) value;
  +         _transletName = (String) value;           
  +         return;
  +     }
  +     else if (name.equals("destination-directory") && value instanceof 
String) {
  +         _destinationDirectory = (String) value;
            return;
        }
  +     else if (name.equals("package-name") && value instanceof String) {
  +         _packageName = (String) value;
  +         return;
  +     }
  +     else if (name.equals("jar-name") && value instanceof String) {
  +         _jarFileName = (String) value;
  +         return;
  +     }
  +     else if (name.equals("generate-translet")) {
  +         if (value instanceof Boolean) {
  +             _generateTranslet = ((Boolean) value).booleanValue();
  +             return;
  +         }
  +         else if (value instanceof String) {
  +             _generateTranslet = ((String) value).equalsIgnoreCase("true");
  +             return;
  +         }
  +     }
  +     else if (name.equals("auto-translet")) {
  +         if (value instanceof Boolean) {
  +             _autoTranslet = ((Boolean) value).booleanValue();
  +             return;
  +         }
  +         else if (value instanceof String) {
  +             _autoTranslet = ((String) value).equalsIgnoreCase("true");
  +             return;
  +         }
  +     }
        else if (name.equals("debug")) {
            if (value instanceof Boolean) {
                _debug = ((Boolean) value).booleanValue();
  @@ -458,6 +536,35 @@
       public Templates newTemplates(Source source)
        throws TransformerConfigurationException 
       {
  +     // If _autoTranslet is true, we will try to load the bytecodes
  +     // from the translet classes without compiling the stylesheet.
  +     if (_autoTranslet)  {
  +         byte[][] bytecodes = null;
  +         String transletClassName = getTransletClassName(source);
  +         
  +         if (_jarFileName != null)
  +             bytecodes = getBytecodesFromJar(source, transletClassName);
  +         else
  +             bytecodes = getBytecodesFromClasses(source, transletClassName); 
    
  +       
  +         if (bytecodes != null) {
  +             if (_debug) {
  +                 if (_jarFileName != null)
  +                     System.err.println(new ErrorMsg(
  +                         ErrorMsg.TRANSFORM_WITH_JAR_STR, transletClassName, 
_jarFileName));
  +                 else
  +                     System.err.println(new ErrorMsg(
  +                         ErrorMsg.TRANSFORM_WITH_TRANSLET_STR, 
transletClassName));
  +             }
  +
  +             // Reset the per-session attributes to their default values
  +             // after each newTemplates() call.
  +             resetTransientAttributes();
  +         
  +             return new TemplatesImpl(bytecodes, transletClassName, null, 
_indentNumber, this);          
  +         }
  +     }
  +     
        // Create and initialize a stylesheet compiler
        final XSLTC xsltc = new XSLTC();
        if (_debug) xsltc.setDebug(true);
  @@ -480,11 +587,55 @@
            }
        }
   
  +     // Set the attributes for translet generation
  +     int outputType = XSLTC.BYTEARRAY_OUTPUT;
  +     if (_generateTranslet || _autoTranslet) {
  +         // Set the translet name
  +         if (!_transletName.equals(DEFAULT_TRANSLET_NAME))
  +             xsltc.setClassName(_transletName);
  +       
  +         if (_destinationDirectory != null)
  +             xsltc.setDestDirectory(_destinationDirectory);
  +         else {
  +             String xslName = getStylesheetFileName(source);
  +             if (xslName != null) {
  +                 File xslFile = new File(xslName);
  +                 String xslDir = xslFile.getParent();
  +         
  +                 if (xslDir != null)
  +                     xsltc.setDestDirectory(xslDir);
  +             }
  +         }
  +       
  +         if (_packageName != null)
  +             xsltc.setPackageName(_packageName);
  +     
  +         if (_jarFileName != null) {
  +             xsltc.setJarFileName(_jarFileName);
  +             outputType = XSLTC.BYTEARRAY_AND_JAR_OUTPUT;
  +         }
  +         else
  +             outputType = XSLTC.BYTEARRAY_AND_FILE_OUTPUT;
  +     }
  +
        // Compile the stylesheet
        final InputSource input = Util.getInputSource(xsltc, source);
  -     byte[][] bytecodes = xsltc.compile(null, input);
  +     byte[][] bytecodes = xsltc.compile(null, input, outputType);
        final String transletName = xsltc.getClassName();
   
  +     // Output to the jar file if the jar file name is set.
  +     if ((_generateTranslet || _autoTranslet)
  +             && bytecodes != null && _jarFileName != null) {
  +         try {
  +             xsltc.outputToJar();
  +         }
  +         catch (java.io.IOException e) { }
  +     }
  +
  +     // Reset the per-session attributes to their default values
  +     // after each newTemplates() call.
  +     resetTransientAttributes();
  +
        // Pass compiler warnings to the error listener
        if (_errorListener != this) {
            try {
  @@ -760,5 +911,328 @@
                result = _parserFactory.newSAXParser().getXMLReader());
        }
        return result;
  +    }
  +    
  +    /**
  +     * Reset the per-session attributes to their default values
  +     */
  +    private void resetTransientAttributes() {
  +     _transletName = DEFAULT_TRANSLET_NAME;
  +     _destinationDirectory = null;
  +     _packageName = null;
  +     _jarFileName = null;    
  +    }
  +        
  +    /**
  +     * Load the translet classes from local .class files and return
  +     * the bytecode array.
  +     *
  +     * @param source The xsl source
  +     * @param fullClassName The full name of the translet
  +     * @return The bytecode array
  +     */
  +    private byte[][] getBytecodesFromClasses(Source source, String 
fullClassName)
  +    {
  +     if (fullClassName == null)
  +         return null;
  +       
  +     String xslFileName = getStylesheetFileName(source);
  +     File xslFile = null;
  +     if (xslFileName != null)
  +         xslFile = new File(xslFileName);
  +     
  +     // Find the base name of the translet
  +     final String transletName;
  +     int lastDotIndex = fullClassName.lastIndexOf('.');
  +     if (lastDotIndex > 0)
  +         transletName = fullClassName.substring(lastDotIndex+1);
  +     else
  +         transletName = fullClassName;
  +             
  +     // Construct the path name for the translet class file
  +     String transletPath = fullClassName.replace('.', '/');
  +     if (_destinationDirectory != null) {
  +         transletPath = _destinationDirectory + "/" + transletPath + 
".class";
  +     }
  +     else {
  +         if (xslFile != null && xslFile.getParent() != null)
  +             transletPath = xslFile.getParent() + "/" + transletPath + 
".class";
  +         else
  +             transletPath = transletPath + ".class";
  +     }
  +                     
  +     // Return null if the translet class file does not exist.
  +     File transletFile = new File(transletPath);
  +     if (!transletFile.exists())
  +         return null;
  +               
  +     // Compare the timestamps of the translet and the xsl file.
  +     // If the translet is older than the xsl file, return null 
  +     // so that the xsl file is used for the transformation and
  +     // the translet is regenerated.
  +     if (xslFile != null && xslFile.exists()) {
  +         long xslTimestamp = xslFile.lastModified();
  +         long transletTimestamp = transletFile.lastModified();
  +         if (transletTimestamp < xslTimestamp)
  +             return null;
  +     }
  +     
  +     // Load the translet into a bytecode array.
  +     Vector bytecodes = new Vector();
  +     int fileLength = (int)transletFile.length();
  +     if (fileLength > 0) {
  +         FileInputStream input = null;
  +         try {
  +             input = new FileInputStream(transletFile);
  +         }
  +         catch (FileNotFoundException e) {
  +             return null;
  +         }
  +       
  +         byte[] bytes = new byte[fileLength];
  +         try {
  +             readFromInputStream(bytes, input, fileLength);
  +             input.close();
  +         }
  +         catch (IOException e) {
  +             return null;
  +         }
  +       
  +         bytecodes.addElement(bytes);
  +     }
  +     else
  +         return null;
  +     
  +     // Find the parent directory of the translet.
  +     String transletParentDir = transletFile.getParent();
  +     if (transletParentDir == null)
  +         transletParentDir = System.getProperty("user.dir");
  +       
  +     File transletParentFile = new File(transletParentDir);
  +     
  +     // Find all the auxiliary files which have a name pattern of 
"transletClass$nnn.class".
  +     final String transletAuxPrefix = transletName + "$";
  +     File[] auxfiles = transletParentFile.listFiles(new FilenameFilter() {
  +             public boolean accept(File dir, String name)
  +             {
  +                 return (name.endsWith(".class") && 
name.startsWith(transletAuxPrefix));     
  +             }
  +           });
  +     
  +     // Load the auxiliary class files and add them to the bytecode array.
  +     for (int i = 0; i < auxfiles.length; i++)
  +     {
  +         File auxfile = auxfiles[i];
  +         int auxlength = (int)auxfile.length();
  +         if (auxlength > 0) {
  +             FileInputStream auxinput = null;
  +             try {
  +                 auxinput = new FileInputStream(auxfile);
  +             }
  +             catch (FileNotFoundException e) {
  +                 continue;
  +             }
  +       
  +             byte[] bytes = new byte[auxlength];
  +         
  +             try {
  +                 readFromInputStream(bytes, auxinput, auxlength);
  +                 auxinput.close();
  +             }
  +             catch (IOException e) {
  +                 continue;
  +             }
  +         
  +             bytecodes.addElement(bytes);        
  +         }
  +     }
  +     
  +     // Convert the Vector of byte[] to byte[][].
  +     final int count = bytecodes.size();
  +     if ( count > 0) {
  +         final byte[][] result = new byte[count][1];
  +         for (int i = 0; i < count; i++) {
  +             result[i] = (byte[])bytecodes.elementAt(i);
  +         }
  +       
  +         return result;
  +     }
  +     else
  +         return null;
  +    }
  +    
  +    /**
  +     * Load the translet classes from the jar file and return the bytecode.
  +     *
  +     * @param source The xsl source
  +     * @param fullClassName The full name of the translet
  +     * @return The bytecode array
  +     */
  +    private byte[][] getBytecodesFromJar(Source source, String fullClassName)
  +    {
  +     String xslFileName = getStylesheetFileName(source);
  +     File xslFile = null;
  +     if (xslFileName != null)
  +         xslFile = new File(xslFileName);
  +      
  +             // Construct the path for the jar file
  +             String jarPath = null;
  +             if (_destinationDirectory != null)
  +            jarPath = _destinationDirectory + "/" + _jarFileName;
  +             else {
  +                 if (xslFile != null && xslFile.getParent() != null)
  +             jarPath = xslFile.getParent() + "/" + _jarFileName;
  +         else
  +             jarPath = _jarFileName;
  +     }
  +            
  +             // Return null if the jar file does not exist.
  +             File file = new File(jarPath);
  +             if (!file.exists())
  +            return null;
  +
  +             // Compare the timestamps of the jar file and the xsl file. 
Return null
  +             // if the xsl file is newer than the jar file.
  +     if (xslFile != null && xslFile.exists()) {
  +         long xslTimestamp = xslFile.lastModified();
  +         long transletTimestamp = file.lastModified();
  +         if (transletTimestamp < xslTimestamp)
  +             return null;
  +     }
  +      
  +             // Create a ZipFile object for the jar file
  +             ZipFile jarFile = null;
  +             try {
  +            jarFile = new ZipFile(file);
  +             }
  +             catch (IOException e) {
  +            return null;
  +             }
  +      
  +             String transletPath = fullClassName.replace('.', '/');
  +             String transletAuxPrefix = transletPath + "$";
  +             String transletFullName = transletPath + ".class";
  +      
  +             Vector bytecodes = new Vector();      
  +      
  +             // Iterate through all entries in the jar file to find the 
  +             // translet and auxiliary classes.
  +             Enumeration entries = jarFile.entries();
  +             while (entries.hasMoreElements())
  +             {
  +            ZipEntry entry = (ZipEntry)entries.nextElement();
  +            String entryName = entry.getName();
  +            if (entry.getSize() > 0 && 
  +               (entryName.equals(transletFullName) ||
  +                       (entryName.endsWith(".class") && 
  +                           entryName.startsWith(transletAuxPrefix))))
  +            {
  +             try {
  +                         InputStream input = jarFile.getInputStream(entry);
  +                         int size = (int)entry.getSize();
  +                         byte[] bytes = new byte[size];
  +                         readFromInputStream(bytes, input, size);
  +                         input.close();
  +                         bytecodes.addElement(bytes);
  +             }
  +             catch (IOException e) {
  +                         return null;
  +             }          
  +            }
  +             }
  +      
  +        // Convert the Vector of byte[] to byte[][].
  +     final int count = bytecodes.size();
  +     if (count > 0) {
  +         final byte[][] result = new byte[count][1];
  +         for (int i = 0; i < count; i++) {
  +             result[i] = (byte[])bytecodes.elementAt(i);
  +         }
  +       
  +         return result;
  +     }
  +     else
  +         return null;
  +    }
  +    
  +    /**
  +     * Read a given number of bytes from the InputStream into a byte array.
  +     *
  +     * @param bytes The byte array to store the input content.
  +     * @param input The input stream.
  +     * @param size The number of bytes to read.
  +     */
  +    private void readFromInputStream(byte[] bytes, InputStream input, int 
size)
  +             throws IOException
  +    {
  +      int n = 0;
  +      int offset = 0;
  +      int length = size;
  +      while (length > 0 && (n = input.read(bytes, offset, length)) > 0) {
  +          offset = offset + n;
  +          length = length - n;
  +      }    
  +    }
  +
  +    /**
  +     * Return the fully qualified class name of the translet
  +     *
  +     * @param source The Source
  +     * @return The full name of the translet class
  +     */
  +    private String getTransletClassName(Source source)
  +    {      
  +        String transletBaseName = null;
  +        if (!_transletName.equals(DEFAULT_TRANSLET_NAME))
  +            transletBaseName = _transletName;
  +             else {
  +            String systemId = source.getSystemId();
  +            if (systemId != null) {
  +             String baseName = Util.baseName(systemId);
  +                if (baseName != null)
  +                 transletBaseName = Util.noExtName(baseName);
  +            }
  +             }
  +      
  +        if (transletBaseName == null)
  +            transletBaseName = DEFAULT_TRANSLET_NAME;
  +        
  +        if (_packageName != null)
  +            return _packageName + "." + transletBaseName;
  +        else
  +            return transletBaseName;
  +    }
  +        
  +    /**
  +     *  Return the local file name from the systemId of the Source object
  +     *
  +     * @param source The Source
  +     * @return The file name in the local filesystem, or null if the
  +     * systemId does not represent a local file.
  +     */
  +    private String getStylesheetFileName(Source source)
  +    {
  +     String systemId = source.getSystemId();
  +             if (systemId != null) {
  +            File file = new File(systemId);
  +            if (file.exists())
  +                return systemId;
  +            else {
  +                     URL url = null;
  +             try {
  +                 url = new URL(systemId);
  +             }
  +             catch (MalformedURLException e) {
  +                 return null;
  +             }
  +          
  +             if ("file".equals(url.getProtocol()))
  +                 return url.getFile();
  +             else
  +                 return null;
  +            }
  +             }
  +             else
  +            return null;
       }
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.14.2.3  +36 -2     
xml-xalan/java/src/org/apache/xpath/functions/FuncExtFunction.java
  
  Index: FuncExtFunction.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncExtFunction.java,v
  retrieving revision 1.14.2.2
  retrieving revision 1.14.2.3
  diff -u -r1.14.2.2 -r1.14.2.3
  --- FuncExtFunction.java      12 Sep 2002 16:07:36 -0000      1.14.2.2
  +++ FuncExtFunction.java      4 Oct 2002 09:24:47 -0000       1.14.2.3
  @@ -140,16 +140,50 @@
         }
       }
     }
  -  //called by StylesheetHandler.createXPath() -- dml 
  +  
  +  /**
  +   * Return the namespace of the extension function.
  +   *
  +   * @return The namespace of the extension function.
  +   */
     public String getNamespace()
     {
       return m_namespace;
     }
  +  
  +  /**
  +   * Return the name of the extension function.
  +   *
  +   * @return The name of the extension function.
  +   */
     public String getFunctionName()
     {
       return m_extensionName;
     }
   
  +  /** 
  +   * Return the nth argument passed to the extension function.
  +   * 
  +   * @param n The argument number index.
  +   * @return The Expression object at the given index.
  +   */    
  +  public Expression getArg(int n) {
  +    if (n >= 0 && n < m_argVec.size())
  +      return (Expression) m_argVec.elementAt(n);
  +    else
  +      return null;
  +  }
  +
  +  /**
  +   * Return the number of arguments that were passed
  +   * into this extension function.
  +   *
  +   * @return The number of arguments.
  +   */    
  +  public int getArgCount() {
  +    return m_argVec.size();
  +  }
  +
     /**
      * Create a new FuncExtFunction based on the qualified name of the 
extension,
      * and a unique method key.
  @@ -275,7 +309,7 @@
     {
         for (int i = 0; i < m_argVec.size(); i++)
         {
  -         Expression exp = (Expression)m_argVec.get(i);
  +         Expression exp = (Expression)m_argVec.elementAt(i);
            exp.callVisitors(new ArgExtOwner(exp), visitor);
         }
       
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to