Render data with HTML Tags using XSL Value-Of


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.

Abirami RajendranAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

chaitu chaituCommented:
did you put below tag at the top of the xsl;

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Gertone (Geert Bormans)Information ArchitectCommented:
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
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Abirami RajendranAuthor 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 ArchitectCommented:
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
Abirami RajendranAuthor Commented:
I've requested that this question be deleted for the following reason:

found own solution
Gertone (Geert Bormans)Information ArchitectCommented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.