/**
   * Send a message to diagnostics. The xsl:message instruction sends a message in a way that is
   * dependent on the XSLT transformer. The content of the xsl:message instruction is a template.
   * The xsl:message is instantiated by instantiating the content to create an XML fragment. This
   * XML fragment is the content of the message.
   *
   * @param transformer non-null reference to the the current transform-time state.
   * @throws TransformerException
   */
  public void execute(TransformerImpl transformer) throws TransformerException {

    String data = transformer.transformToString(this);

    transformer.getMsgMgr().message(this, data, m_terminate);

    if (m_terminate)
      transformer
          .getErrorListener()
          .fatalError(
              new TransformerException(
                  XSLMessages.createMessage(
                      XSLTErrorResources.ER_STYLESHEET_DIRECTED_TERMINATION,
                      null))); // "Stylesheet directed termination"));
  }
예제 #2
0
파일: ElemComment.java 프로젝트: srnsw/xena
  /**
   * Execute the xsl:comment transformation
   *
   * @param transformer non-null reference to the the current transform-time state.
   * @throws TransformerException
   */
  public void execute(TransformerImpl transformer) throws TransformerException {
    if (transformer.getDebug()) transformer.getTraceManager().fireTraceEvent(this);
    try {
      // Note the content model is:
      // <!ENTITY % instructions "
      // %char-instructions;
      // | xsl:processing-instruction
      // | xsl:comment
      // | xsl:element
      // | xsl:attribute
      // ">
      String data = transformer.transformToString(this);

      transformer.getResultTreeHandler().comment(data);
    } catch (org.xml.sax.SAXException se) {
      throw new TransformerException(se);
    } finally {
      if (transformer.getDebug()) transformer.getTraceManager().fireTraceEndEvent(this);
    }
  }