On 8/12/06, Luuk Jansen <subscribe(_at_)angelosystems(_dot_)com> wrote:
I have a problem with the following, and breaking my head over it the
last couple of days.
I have the content element as seen below in a xml document which has to
be transformed to a PDF. That is no problem with the Apache FOP and I
have almost everything working except the view parts that use the XHTML.
How do I create a template that can transfer the XHTML code to XSL:FO
code on the fly (preserving layout etc). I tried importing the
xhtml2fo.xsl sheet into the general style sheet and then call
apply-templates inside the content element, but that doesn't work, I
guess because the tags are not correct (as in <).
The resulting PDF document shows the HTML perfect (with <HTML> etc.).
I was trying to apply-templates to the code and then put it in a
variable on which the xhtml2fo.xsl template can be applied, but FOP
crashed on that try.
Does anybody have any suggestion?
Thanks a million in advance,
Regards,
Luuk
_____________
A small snip of the embedded code is (I replaced the text):
<Content Version="1.0"
type="XHTML"><html><head></head><body><p
class="MsoNormal" style="margin-top: 6pt; text-align: justify;
text-indent: 21.25pt; font-family: times new roman;"><font
size="3"><span style="font-size: 12pt;">
Because the markup is escaped you will need to parse it twice. You
have a <Content> element containing a string:
<Content><html>
In order for a template to be applied to <html> you need to parse it
once to get angle brackets:
<Content><html>
...then parse it again to get an <html> element.
To do this you can use an extension such as saxon:parse() eg:
<xsl:variable name="htmlContent" select="saxon:parse(/pathto/Content)"/>
and then:
<xsl:apply-templates select="$htmlContent"/>
cheers
andrew
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--