tia_kamakshi
asked on
Printing html decoded value from xslt on webpage
Hi Experts,
My xml node <LongDescription> has html endoded string like below
<LongDescription><p> <strong >Locati on:</st rong> Beverly Hills.</p>
<p>The Beverly Wilshire is at one of the world’s most famous intersections – Rodeo Drive and Wilshire Boulevard, with its exclusive shops, galleries and restaurants. The property features luxuriously appointed rooms, award-winning restaurants and lively entertainment. Many of the hotel’s guest rooms have spectacular views of Rodeo Drive, the Hollywood Hills and the L.A. skyline. Los Angeles International Airport is 29 kilometres away.</p>
<p><strong>Fac ilities:&l t;/strong& gt; 395 rooms and suites. Two restaurants, bar, 24-hour room service, shop, hairdresser, beauty salon, safety deposit boxes, business centre, babysitting, interconnecting and non-smoking rooms.
<br/>
<br/>
<strong>Superior Rooms:</strong> Air-conditioning, TV, CD, data ports, minibar and safe.
<br/>
<br/>
<strong>Sports and leisure:</strong> Outdoor pool, fitness centre, spa, sauna, jacuzzi, steam bath and massage.</p>
<p><strong>Che ck-in:< /strong> ; 1500 hours</p>
<p><strong>Che ck-out:< ;/strong&g t; 1200 hours.
<br/></p></Lon gDescripti on>
When I am reading the text from xslt like below
<xsl:value-of select ="LongDescription" disable-output-escaping="y es" />
All html formating is not printing in the web page
Please can you help, so that format of the html in node <LongDescription> prints as is on web page
Please find attached my xml and xslt file
Please guide
Thanks
dcp248933-436029.xml
HotelListDynamic.xsl
My xml node <LongDescription> has html endoded string like below
<LongDescription><p>
<p>The Beverly Wilshire is at one of the world’s most famous intersections – Rodeo Drive and Wilshire Boulevard, with its exclusive shops, galleries and restaurants. The property features luxuriously appointed rooms, award-winning restaurants and lively entertainment. Many of the hotel’s guest rooms have spectacular views of Rodeo Drive, the Hollywood Hills and the L.A. skyline. Los Angeles International Airport is 29 kilometres away.</p>
<p><strong>Fac
<br/>
<br/>
<strong>Superior Rooms:</strong> Air-conditioning, TV, CD, data ports, minibar and safe.
<br/>
<br/>
<strong>Sports and leisure:</strong> Outdoor pool, fitness centre, spa, sauna, jacuzzi, steam bath and massage.</p>
<p><strong>Che
<p><strong>Che
<br/></p></Lon
When I am reading the text from xslt like below
<xsl:value-of select ="LongDescription" disable-output-escaping="y
All html formating is not printing in the web page
Please can you help, so that format of the html in node <LongDescription> prints as is on web page
Please find attached my xml and xslt file
Please guide
Thanks
dcp248933-436029.xml
HotelListDynamic.xsl
I would make that for-each an apply-templates by the way
ASKER
Thanks Gertone for your reply.
My I am not seeing formatting on my web page... I am loosing all formatting done.
I have provided you the actual xml and xslt
What can be the reason that I am loosing my formatting in my html?
Please guide
Thanks again
My I am not seeing formatting on my web page... I am loosing all formatting done.
I have provided you the actual xml and xslt
What can be the reason that I am loosing my formatting in my html?
Please guide
Thanks again
How do you view the results and how do you run the XSLT?
If this is the actual XML and XSLT you need to change the context in teh for-each as I indicated
If this is the actual XML and XSLT you need to change the context in teh for-each as I indicated
ASKER
<LongDescription> node is printing on the html page but with no formatting
Please suggest
Please suggest
again, how do you execute the XSLT and how do you view the results?
This is important information.
If for instance you are running this in FireFox or using the TransformiX XSLT processor,
this will not work simply because there is no support for disable-output-escaping there
d-o-e is not mandatory and some processors simply don't support it (and claim they never will)
In that particular case, you need to preprocess the lot to make it XML nodes instead of a text node prior to the XSLT
(and hope the html is wellformed XML)
so please tell me how you execute the XSLT and how you view the result
This is important information.
If for instance you are running this in FireFox or using the TransformiX XSLT processor,
this will not work simply because there is no support for disable-output-escaping there
d-o-e is not mandatory and some processors simply don't support it (and claim they never will)
In that particular case, you need to preprocess the lot to make it XML nodes instead of a text node prior to the XSLT
(and hope the html is wellformed XML)
so please tell me how you execute the XSLT and how you view the result
ASKER
Hi Gertone,
I applogise, Node <LongDescription> is written in xml file as below:
-------------------------- ---------- ---------- ---------- ----
<LongDescription>
<p>
<strong>Location:</strong> Beverly Hills1.</p>
<p>The Beverly Wilshire is at one of the world’s most famous intersections – Rodeo Drive and Wilshire Boulevard, with its exclusive shops, galleries and restaurants. The property features luxuriously appointed rooms, award-winning restaurants and lively entertainment. Many of the hotel’s guest rooms have spectacular views of Rodeo Drive, the Hollywood Hills and the L.A. skyline. Los Angeles International Airport is 29 kilometres away.</p>
<p>
<strong>Facilities:</stron g> 395 rooms and suites. Two restaurants, bar, 24-hour room service, shop, hairdresser, beauty salon, safety deposit boxes, business centre, babysitting, interconnecting and non-smoking rooms.
<br></br>
<br></br>
<strong>Superior Rooms:</strong> Air-conditioning, TV, CD, data ports, minibar and safe.
<br></br>
<br></br>
<strong>Sports and leisure:</strong> Outdoor pool, fitness centre, spa, sauna, jacuzzi, steam bath and massage.</p>
<p>
<strong>Check-in:</strong> 1500 hours</p>
<p>
<strong>Check-out:</strong > 1200 hours.
<br></br>
</p>
</LongDescription>
-------------------------- ---------- ---------- ---------- ----
Please find correct xml attached.
In correct xslt, for-each loop is written as
<xsl:for-each select="Result/XmlContent" >
In my webpage, html of long description is loosing html formatting, done in node
<LongDescription>
Please advice
Many Thanks again
dcp248933-436029.xml
HotelListDynamic.xsl
I applogise, Node <LongDescription> is written in xml file as below:
--------------------------
<LongDescription>
<p>
<strong>Location:</strong>
<p>The Beverly Wilshire is at one of the world’s most famous intersections – Rodeo Drive and Wilshire Boulevard, with its exclusive shops, galleries and restaurants. The property features luxuriously appointed rooms, award-winning restaurants and lively entertainment. Many of the hotel’s guest rooms have spectacular views of Rodeo Drive, the Hollywood Hills and the L.A. skyline. Los Angeles International Airport is 29 kilometres away.</p>
<p>
<strong>Facilities:</stron
<br></br>
<br></br>
<strong>Superior Rooms:</strong> Air-conditioning, TV, CD, data ports, minibar and safe.
<br></br>
<br></br>
<strong>Sports and leisure:</strong> Outdoor pool, fitness centre, spa, sauna, jacuzzi, steam bath and massage.</p>
<p>
<strong>Check-in:</strong>
<p>
<strong>Check-out:</strong
<br></br>
</p>
</LongDescription>
--------------------------
Please find correct xml attached.
In correct xslt, for-each loop is written as
<xsl:for-each select="Result/XmlContent"
In my webpage, html of long description is loosing html formatting, done in node
<LongDescription>
Please advice
Many Thanks again
dcp248933-436029.xml
HotelListDynamic.xsl
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This was great.Many Many Thanks for your great help
Regards,
Regards,
welcome
and how do you view this?
If I run your XSLT against your XML (after correcting the obvious conbtext issue in the for-each)
I get exactly what I need... the layouted description
Or is it the context issue that is the problem?
In the for each you need to strip the path up to the level on the root element
line 13 should read
<xsl:for-each select="Result/XmlContent"
if the XML you sent really is teh source