By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,024 Members | 1,945 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,024 IT Pros & Developers. It's quick & easy.

Inserting external HTML into xsl output

P: n/a
Hi

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?/

Thanks
Eva

Sep 29 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
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
Probably.

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.

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Sep 29 '06 #2

P: n/a


ev*********@gmail.com wrote:

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.
You can try whether the XSLT processor supports disable-output-escaping
<http://www.w3.org/TR/xslt#disable-output-escaping>
e.g
<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
processor.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Sep 29 '06 #3

P: n/a
Thanks Joe!
I am using Xalan processor. Could you give me an example
Joe Kesselman wrote:
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

Probably.

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.

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Sep 29 '06 #4

P: n/a
Martin Honnen wrote:
You can try whether the XSLT processor supports disable-output-escaping
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.

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Sep 29 '06 #5

P: n/a
For information about writing a Xalan extension -- what the function can
return and how Xalan will interpret it -- see
http://xml.apache.org/xalan-j/extensions.html

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.)
Sep 29 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.