Package org.apache.xalan.xsltc.compiler.util

Examples of org.apache.xalan.xsltc.compiler.util.ClassGenerator


    public void translate() {
  Output lastOutputElement = null;
  _className = getXSLTC().getClassName();

  // Define a new class by extending TRANSLET_CLASS
  final ClassGenerator classGen =
      new ClassGenerator(_className,
             TRANSLET_CLASS,
             Constants.EMPTYSTRING,
             ACC_PUBLIC | ACC_SUPER,
             null, this);
 
  addDOMField(classGen);

  // Compile transform() to initialize parameters, globals & output
  // and run the transformation
  compileTransform(classGen);

  // Translate all non-template elements and filter out all templates
  final Enumeration elements = elements();
  while (elements.hasMoreElements()) {
      Object element = elements.nextElement();
      // xsl:template
      if (element instanceof Template) {
    // Separate templates by modes
    final Template template = (Template)element;
    _templates.addElement(template);
    getMode(template.getModeName()).addTemplate(template);
      }
      // xsl:attribute-set
      else if (element instanceof AttributeSet) {
    ((AttributeSet)element).translate(classGen, null);
      }
      else if (element instanceof Output) {
    // save the element for later to pass to compileConstructor
    Output output = (Output)element;
    if (output.enabled()) lastOutputElement = output;
      }
      else {
    // Global variables and parameters are handled elsewhere.
    // Other top-level non-template elements are ignored. Literal
    // elements outside of templates will never be output.
      }
  }

  processModes();
  compileModes(classGen);
  compileConstructor(classGen, lastOutputElement);

  if (!getParser().errorsFound()) {
      getXSLTC().dumpClass(classGen.getJavaClass());
  }
    }
View Full Code Here

TOP

Related Classes of org.apache.xalan.xsltc.compiler.util.ClassGenerator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.