/**
   * Receive notification of the start of an element.
   *
   * @param handler The calling StylesheetHandler/TemplatesBuilder.
   * @param uri The Namespace URI, or the empty string if the element has no Namespace URI or if
   *     Namespace processing is not being performed.
   * @param localName The local name (without prefix), or the empty string if Namespace processing
   *     is not being performed.
   * @param rawName The raw XML 1.0 name (with prefix), or the empty string if raw names are not
   *     available.
   * @param attributes The attributes attached to the element. If there are no attributes, it shall
   *     be an empty Attributes object.
   * @see org.apache.xalan.processor.StylesheetHandler#startElement
   * @see org.apache.xalan.processor.StylesheetHandler#endElement
   * @see org.xml.sax.ContentHandler#startElement
   * @see org.xml.sax.ContentHandler#endElement
   * @see org.xml.sax.Attributes
   */
  public void startElement(
      StylesheetHandler handler,
      String uri,
      String localName,
      String rawName,
      Attributes attributes)
      throws org.xml.sax.SAXException {

    DecimalFormatProperties dfp = new DecimalFormatProperties(handler.nextUid());

    setPropertiesFromAttributes(handler, rawName, attributes, dfp);
    handler.getStylesheet().setDecimalFormat(dfp);

    handler.getStylesheet().appendChild(dfp);
  }
示例#2
0
  /**
   * Receive notification of the start of an xsl:output element.
   *
   * @param handler The calling StylesheetHandler/TemplatesBuilder.
   * @param uri The Namespace URI, or the empty string if the element has no Namespace URI or if
   *     Namespace processing is not being performed.
   * @param localName The local name (without prefix), or the empty string if Namespace processing
   *     is not being performed.
   * @param rawName The raw XML 1.0 name (with prefix), or the empty string if raw names are not
   *     available.
   * @param attributes The attributes attached to the element. If there are no attributes, it shall
   *     be an empty Attributes object.
   * @throws org.xml.sax.SAXException
   */
  public void startElement(
      StylesheetHandler handler,
      String uri,
      String localName,
      String rawName,
      Attributes attributes)
      throws org.xml.sax.SAXException {
    // Hmmm... for the moment I don't think I'll have default properties set for this. -sb
    m_outputProperties = new OutputProperties();

    m_outputProperties.setDOMBackPointer(handler.getOriginatingNode());
    m_outputProperties.setLocaterInfo(handler.getLocator());
    m_outputProperties.setUid(handler.nextUid());
    setPropertiesFromAttributes(handler, rawName, attributes, this);

    // Access this only from the Hashtable level... we don't want to
    // get default properties.
    String entitiesFileName =
        (String) m_outputProperties.getProperties().get(OutputPropertiesFactory.S_KEY_ENTITIES);

    if (null != entitiesFileName) {
      try {
        String absURL =
            SystemIDResolver.getAbsoluteURI(entitiesFileName, handler.getBaseIdentifier());
        m_outputProperties.getProperties().put(OutputPropertiesFactory.S_KEY_ENTITIES, absURL);
      } catch (TransformerException te) {
        handler.error(te.getMessage(), te);
      }
    }

    handler.getStylesheet().setOutput(m_outputProperties);

    ElemTemplateElement parent = handler.getElemTemplateElement();
    parent.appendChild(m_outputProperties);

    m_outputProperties = null;
  }