xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ferran Basora <fcsonl...@gmail.com>
Subject Re: How to convert HTML tags(rich text) into XML-FO?
Date Mon, 09 Mar 2009 15:16:47 GMT

Hello,

I have developed a simple example using namespaces:

The XML:

<?xml version="1.0" encoding="UTF-8"?>
<root>
	<name>TEST HTML-FO</name>
	<descripcion xmlns="http://www.w3.org/1999/xhtml">Pellentesque habitant
morbi tristiquesenectus et netus et malesuada fames ac
<u>turpis</u></descripcion>
</root>

the XSLT:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:xhtml="http://www.w3.org/1999/xhtml">

...
				<fo:flow flow-name="xsl-region-body" font-size="10pt">
					<fo:block font-size="15pt">
						<xsl:value-of select="name"/>
					</fo:block>
					<fo:block font-size="15pt">
						<xsl:apply-templates select="xhtml:descripcion"/>
					</fo:block>
				</fo:flow>
...

	<!-- HTML ENTITIES -->
	<xsl:template match="xhtml:b">
		<fo:inline font-weight="bold">
			<xsl:apply-templates/>
		</fo:inline>
	</xsl:template>
	<xsl:template match="xhtml:i">
		<fo:inline font-style="italic">
			<xsl:apply-templates/>
		</fo:inline>
	</xsl:template>
	<xsl:template match="xhtml:u">
		<fo:inline text-decoration="underline">
			<xsl:apply-templates/>
		</fo:inline>
	</xsl:template>
</xsl:stylesheet>

May be it usefull...

I attach the files.
http://www.nabble.com/file/p22413453/htmlfo.xml htmlfo.xml 
http://www.nabble.com/file/p22413453/htmlfo.xslt htmlfo.xslt 

Bye!






gennady wrote:
> 
> I have a basic task. The website has a text area to type some comments.
> Currently it's a regular text area and the text is appearing as is in
> generated PDF using FOP-0.95. 
> Now new task is to enable user to create rich text for the comments. I
> will probably use Yahoo UI JavaScript library. Or do you have other
> suggestions?
> As a result, Yahoo JS will generate some HTML tags in this text. So how to
> convert those tags into PDF with FOP (how to interpret those tags)?
> Thank you,
> 
> -Gennady
> 

-- 
View this message in context: http://www.nabble.com/How-to-convert-HTML-tags%28rich-text%29-into-XML-FO--tp21672932p22413453.html
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Mime
View raw message