Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in HTML to Formatting Objects

 
ramkumar rengarajan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 20771
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic