![]() |
Interpreting HTML content |
Post Reply
|
| Author | ||
het_hs
Newbie
Joined: 21 Apr 2010 Location: Mumbai Posts: 4 |
Post Options
Quote Reply
Topic: Interpreting HTML contentPosted: 21 Apr 2010 at 7:21am |
|
|
How to intepret HTML content in xsl-fo designer?
I have a field which contains HTML tags inside the value and that HTML tags needs to be interepreted on xsl-fo side so it shows the formatted text as inputted by User.
There is a rich text control on .NET side which allows user to format the text and the is stored in database with HTML tags. The same needs to be interpreted on xsl-fo while rendering the output.
How can we do this? Like this control does. It takes the query in formatted text. Now if I want to show this formatted text on report developed in xsl-fo how do I do that?
Thanks in advance.
Hetal
|
||
![]() |
||
hugo
Newbie
Joined: 01 Jul 2010 Location: Amsterdam, NL Posts: 5 |
Post Options
Quote Reply
Posted: 01 Jul 2010 at 9:11am |
|
|
I need this too. Is there already a solution for this?
|
||
![]() |
||
radup
Admin Group
Adminstrator Joined: 19 May 2008 Posts: 83 |
Post Options
Quote Reply
Posted: 18 Aug 2011 at 12:37pm |
|
|
To interpret HTML tags you need to define a custom xslt code. This can be done by using "Global XSLT Code" dialog. More information about using this dialog is available here http://www.ecrion.com/products/xfdesigner/XFDesignerHelp/hidd_edit_raw_xslt.htm.
For example for “b” html tag you have the following xslt code:
Should look something like this:
Edited by radup - 18 Aug 2011 at 12:42pm |
||
|
I'm happy when my mind is free and my senses are occupied.
|
||
![]() |
||
JohanPotgieter
Newbie
Joined: 13 Dec 2011 Location: South Africa Posts: 3 |
Post Options
Quote Reply
Posted: 13 Dec 2011 at 4:11am |
|
|
I have tried this on a section with this text:
<b><div align="left"><font face="trebuchet ms" size="3">Replacement value condition</font></div></b> and it had no effect. my xfd:field looked like this: <xfd:field xpath="SPEC.TEXT" fo:id="582A6B21" fo:font-family="Arial" fo:font-size="9pt" apply-templates="true"/> with SPEC.TEXT being the field to contain the html. Any help will be appreciated. |
||
![]() |
||
radup
Admin Group
Adminstrator Joined: 19 May 2008 Posts: 83 |
Post Options
Quote Reply
Posted: 13 Dec 2011 at 6:53am |
|
|
Hi Johan,
You need to define in Global XSLT a template match
for each html tag occurred in your xml. For example you will need to define an interpretation for div tag, font tag etc.:
Regards, Radu
|
||
![]() |
||
JohanPotgieter
Newbie
Joined: 13 Dec 2011 Location: South Africa Posts: 3 |
Post Options
Quote Reply
Posted: 15 Dec 2011 at 2:58am |
|
|
Hi there,
I must be missing something here. I have added the XSLT to "Review -> Global XSL. I also added apply-templates="true" to the xfd:field containing the html. When I generate the pdf or print layout the html tags are still there. What am I missing here? regards, Johan |
||
![]() |
||
justinw
Admin Group
Joined: 08 Dec 2011 Posts: 162 |
Post Options
Quote Reply
Posted: 11 Apr 2013 at 12:29pm |
|
|
In 2012 we added simplified functionality for accomplishing these goals of HTML tag inclusion. As this thread suggests, previously this was accomplished only by using Global XSLT. Based on a recurring need from our customers, we added a simple feature.
Now you only need to drag your element containing the HTML into the Design Surface. When you release the mouse button, you will need to select "HTML Field" from the contextual menu that will appear. For more about this useful feature, you can access the XF Designer product manual using this link:
Edited by justinw - 11 Apr 2013 at 12:34pm |
||
![]() |
||
Harry
Newbie
Joined: 13 Jun 2013 Location: Raleigh Posts: 1 |
Post Options
Quote Reply
Posted: 13 Jun 2013 at 2:20pm |
|
|
Hello,
The HTML Filed option you described here does not work when you have HTML content inside the "Value" field of the XML. It will work when your XML itself is generated from HTML, but if you have HTML formatting in the "value" field, how can I retain the formatting in the output? Here is an example of my XML: (I deleted lot of text for ease of reading) <Description typeid="2" value="<p style="font:13px/19.18px sans-serif;margin:0.4em 0px 0.5em;color:#000000;text-transform:none;text-indent:0px;letter-spacing:normal;word-spacing:0px;white-space:normal;background-color:#ffffff;-webkit-text-stroke-width:0px;"><strong>Trigonometry</strong><span class="Apple-converted-space">&nbsp;</span>(from<span class="Apple-converted- itle="Precalculus">precalculus</a><span class="Apple-converted-space">&nbsp;</span>course. </p>" /> As you can see, my Description node has two attributes - type and Value. The "Value" attribute has HTML text. When I print it on report, how can I retain the formatting? |
||
![]() |
||
justinw
Admin Group
Joined: 08 Dec 2011 Posts: 162 |
Post Options
Quote Reply
Posted: 13 Jun 2013 at 3:53pm |
|
|
Hello Harry,
Thanks for reaching out to us. Can you send your input XML to support@ecrion.com for a closer look to see if we can find an alternative? This feature is structured to read HTML represented as nodes but not contained within one attribute's value. As an example: <html typeid="2"> <div align="left"> <font size="13px" face="Sans Serif">Trigonometry</font> </div> </html> HTML tags are not accepted inside attribute values. You need to insert the HTML structure at the XML node level: <HTML content> <p>Some text</p> [……..] </HTML content> The transformations for HTML fields are executed internally with the help of an XSL template. The <xsl:template> elements used for HTML specific formatting cannot match XML nodes from within an XML attribute. Edited by justinw - 14 Jun 2013 at 12:13pm |
||
![]() |
||
Post Reply
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |