• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

HTML Tags in XML file

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to give html tags like <b></b> in my xml file. but instead of rendering it, browser displays the tags as it is.
Can anybody suggest a way out.
thanx

The <b></b> tag in the following xml file is shown as it is.
-----------------------------------------------------
XML File: test.xml
-----------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="test.xsl"?>
<person>
<name>
<fname>Neeraj</fname>
<lname><b>Singhal</b></lname>
</name>
</person>
-----------------------------------------------------
XSL File: test.xsl
-----------------------------------------------------
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>

<xsl:template match="person">
<p>
<xsl:apply-templates/>
</p>
</xsl:template>
<xsl:template match="name">
<b>
<xsl:apply-templates/>
</b>
</xsl:template>
<xsl:template match="fname">
<i>
<xsl:value-of select="."/>
</i>
</xsl:template>
<xsl:template match="lname">
<strike>
<xsl:value-of select="."/>
</strike>
</xsl:template>
</xsl:stylesheet>
 
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, what about <b> and </b>?
 
Bob Moranski
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
shoot, I meant "&" "lt" ";" "b" "&" "gt" ";" and "&" "lt" ";" "/" "b" "&" "gt" ";" .
 
Neeraj Singhal
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx Bob,
but still it doesnt work and displays the sequence ("&" "lt" ";" "b" "&" "gt" ";" and "&" "lt" ";" "/" "b" "&" "gt" ";" ) in the form of tags ie <i></i> without rendering it.
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi neeraj,

change your xsl file like this
now your lame will be bold.
xml won't render html tags,it'll display as such.
<xsl:template match="lname">
<strike><b>
<xsl:value-of select="."/>
</strike><b>
</xsl:template>
</xsl:stylesheet>
bye
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!