aspose file tools*
The moose likes XML and Related Technologies and the fly likes Problem in HTML to Formatting Objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Problem in HTML to Formatting Objects" Watch "Problem in HTML to Formatting Objects" New topic
Author

Problem in HTML to Formatting Objects

ramkumar rengarajan
Greenhorn

Joined: Jul 31, 2009
Posts: 4
Hi all,

In my DOM (Document) object, I have an element called bodyHeader1 and its value is <b><i>Overview</i></b>. In my XSL, I am formatting HTML tags into FO thru <xsl:apply-templates select="bodyHeader1" />

For example If the node is b, then call b matching template as below.

<xsl:template match="b">
<fo:inline font-weight="bold">
<xsl:apply-templates select="*|text()"/>
</fo:inline>
</xsl:template>

But what is happening is transformer transforms these angle brackets (<,>) into (&lt; &gt;) which leads to not matching the respective template and apply formatting objects. I came to know this is happening by producing FO file.

I have used HTML to Formatting Objects (FO) conversion guide
link:http://www.ibm.com/developerworks/library/x-xslfo2app/

How would I accomplish matching the respective template and apply formatting objects?

Thanks in advance.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18909
    
    8

ramkumar rengarajan wrote:In my DOM (Document) object, I have an element called bodyHeader1 and its value is <b><i>Overview</i></b>.

But what is happening is transformer transforms these angle brackets (<,>) into (&lt; &gt;)...


I'm not sure what you mean by "its value is...". Elements don't have values in XML. But a lot of people seem to use that terminology to mean "It has a single text node as a child and the value of that text node is..."

If that's what you mean, then the transformer is not converting those angle brackets to XML escapes. They were that way already before the parser got them. Either that, or they were in a CDATA section.

If you want that string to be treated as XML markup, then you should put it in the document as markup. If you put it in the document as text (which is what you might be saying) then the parser and transformer will treat it as text. The only way to make it look like markup is to use the disable-output-escaping attribute which occurs on some of the XSLT elements, but even that just writes it to the output as markup instead of escaping it as text. You still can't deal with it inside your XSLT as markup.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem in HTML to Formatting Objects