Esempio n. 1
0
  /**
   * Parse the version and uri fields of the stylesheet and add an entry to the symbol table mapping
   * the name <tt>__stylesheet_</tt> to an instance of this class.
   */
  public void parseContents(Parser parser) {
    final SymbolTable stable = parser.getSymbolTable();

    /*
    // Make sure the XSL version set in this stylesheet
    if ((_version == null) || (_version.equals(EMPTYSTRING))) {
        reportError(this, parser, ErrorMsg.REQUIRED_ATTR_ERR,"version");
    }
    // Verify that the version is 1.0 and nothing else
    else if (!_version.equals("1.0")) {
        reportError(this, parser, ErrorMsg.XSL_VERSION_ERR, _version);
    }
    */

    // Add the implicit mapping of 'xml' to the XML namespace URI
    addPrefixMapping("xml", "http://www.w3.org/XML/1998/namespace");

    // Report and error if more than one stylesheet defined
    final Stylesheet sheet = stable.addStylesheet(_name, this);
    if (sheet != null) {
      // Error: more that one stylesheet defined
      ErrorMsg err = new ErrorMsg(ErrorMsg.MULTIPLE_STYLESHEET_ERR, this);
      parser.reportError(Constants.ERROR, err);
    }

    // If this is a simplified stylesheet we must create a template that
    // grabs the root node of the input doc ( <xsl:template match="/"/> ).
    // This template needs the current element (the one passed to this
    // method) as its only child, so the Template class has a special
    // method that handles this (parseSimplified()).
    if (_simplified) {
      stable.excludeURI(XSLT_URI);
      Template template = new Template();
      template.parseSimplified(this, parser);
    }
    // Parse the children of this node
    else {
      parseOwnChildren(parser);
    }
  }