Render data with HTML Tags using XSL Value-Of

Abirami Rajendran
Abirami Rajendran used Ask the Experts™
on
Hi,

I am using XSL to render data on the screen. The data from the database contains HTML tags like <BR> <I> etc. I use XSL:Value-Of to display the data on the screen. But the data does not render the text formatted based on the tags. Instead it just shows the tags as part of the text.

For Ex: the data I have is "Desc: <br />OAL=4-1/2"<br />LOC=1-1/2"<br />" and it gets displayed on the screen as is. That is the tags <BR/> get displayed as is.

I use the following code to display the data

<xsl:value-of select="$pDescription" disable-output-escaping="yes"/>

The variable $pDescription holds the above data.

Can someone help me with this.

Thanks
Sriram
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
did you put below tag at the top of the xsl;

<xsl:output method="html" indent="yes" version="4.0"/>

http://www.ibm.com/developerworks/xml/library/x-tiphtml/index.html

Gertone (Geert Bormans)Information Architect
Top Expert 2006
Commented:
Disable output excaping should do the job,
so nothing wrong with your XSLT.

If you say "on the screen" I assume you are using firefox.
Firefox XSLT processor has not implemented d-o-e
(and will never; d-o-e is a non mandatory part of the XSLT spec, so firefox can rightfuly claim they will never support it and still have a conformant XSLT processor)

Can you use Internet Explorer to see if it is correct there?

If not we need to do something fancy with the tags. Is <br/> the only tag you have?

Do you control the XML? It is better not to wrap the HTML in a CDATA section, if the html snippets tend to be wellformed XML
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
Chaituu - Thanks for your inputs. I have that line at the top of the XSL. Still no luck. I also saw the link you had posted, still it does not work.

Gertone - Thanks for your inputs. I am using IE 9.0. And I tried in Chrome & FF too. Still no luck. I do have control over the XML. But I do not have any control over the data that comes in. As of now, I have only the <BR/> tag in the sample data provided by the Client. But I cannot assume that it will only be <BR/>.
Gertone (Geert Bormans)Information Architect
Top Expert 2006

Commented:
So you experience that in Internet Explorer?
That is weird.

Can I see the full source XML and the full XSLT please?
I need context to fix this

Author

Commented:
I've requested that this question be deleted for the following reason:

found own solution
Gertone (Geert Bormans)Information Architect
Top Expert 2006

Commented:
It is a bit unappropriate to engage people for help and then ignore the follow up questions.
And I would be very surprised if your "own solution" is not something found in the verious suggestions posted
Anyway, rather than delete I would appreciate and expect to find here how you solved it

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial