Inserting external HTML into xsl output

Discussion in 'XML' started by eva.mukhija, Sep 29, 2006.

  1. eva.mukhija

    eva.mukhija Guest


    I need to insert some html content generated by certain business logic
    into an xsl output. I have been able to insert custom Java extensions
    and generate the HTML to be outputted. My problem is that xsl
    transformation is not resulting in rendering the content as HTML. I've
    tried xsl:copy-of and xsl:text. I think it is probably generating a
    text node with the given content and writes entire html code as it is
    rather than rendering it. Can somebody provide the solution?/

    eva.mukhija, Sep 29, 2006
    1. Advertisements

  2. I think it is probably generating a

    You didn't say which processor you're using. With Xalan, one solution
    would be for the extension to return the generated content as a DOM
    subtree rather than as text. That would give Xalan the information it
    needs to recognize handle the content as nodes rather than as text.

    With other processors, all I can suggest is that you check their
    documentation for their own extension features. This is not
    well-standardized, unfortunately.
    Joe Kesselman, Sep 29, 2006
    1. Advertisements

  3. You can try whether the XSLT processor supports disable-output-escaping
    <xsl:text disable-output-escaping="yes">&lt;</xsl:text>
    You should however take note that disable-output escaping is an optional
    feature that is usually only support if the XSLT result is serialized to
    a string or stream. And it might not even be supported at all by an XSLT
    Martin Honnen, Sep 29, 2006
  4. eva.mukhija

    eva.mukhija Guest

    Thanks Joe!
    I am using Xalan processor. Could you give me an example
    eva.mukhija, Sep 29, 2006
  5. Good thought, worth a try if you really want to insert the fragments as
    text. Xalan does support that feature, for what it's worth.
    Joseph Kesselman, Sep 29, 2006
  6. For information about writing a Xalan extension -- what the function can
    return and how Xalan will interpret it -- see

    I don't think there's an example in the Xalan samples/extensions
    directory that returns a value that becomes a Node-Set or Result Tree
    Fragment, but that's what you would want if you want to yield something
    that Xalan will consider an XML tree. As that website documents, a
    returned DOM Node or NodeIterator will be treated by Xalan as an XSLT
    node-set, with the exception of a DocumentFragment node which will be
    treated as an XSLT Result Tree Fragment. (The distinction between RTFs
    and nodesets will be going away in XSLT 2.0, for what that's worth.)
    Joseph Kesselman, Sep 29, 2006
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.