Re: [xsl] XSL-FO and unparsed-text()

Subject: Re: [xsl] XSL-FO and unparsed-text()
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Fri, 14 Dec 2007 13:11:49 -0500
Lucas,

At 08:20 AM 12/13/2007, you wrote:
Is there a way to use unparsed-text() in XSL-FO? I have an html file that uses javascript to put some images on it. Using XSLT I can put together an xml with this html file, using unparsed-text() in a html output.
Can I do the same in XSL-FO? I want to put this images in a PDF using XSL-FO and unparsed-text(), but i think that XSL-FO can only get figures directly. Am I right?

Oh dear, I was afraid of that (from your previous post).


The unparsed-text() plus disable-output-escaping trick is not recommended among the cognoscenti, as it both limits your options later regarding how you use and reuse your stylesheets, and it pushes problems in your HTML down the line that are better dealt with up front.

But it's sure not going to work to feed random bits of HTML to an XSL-FO engine and expect it to know what to do with it.

The recommended way of doing this sort of thing is to *transform* your HTML into the desired result, whether that be HTML (sometimes the identity transformation is all that's needed) or XSL-FO or what have you. This requires parsing it, not pulling it in with unparsed-text and pouring it out again with disable-output-escaping. While it may seem like extra trouble to go to, it's actually far more adaptable and safer too -- as in this case.

Cheers,
Wendell



======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================

Current Thread