• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

HTML Tags in XML file

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, what about <b> and </b>?
 
Bob Moranski
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Whose rules are you playing by? This tiny ad doesn't respect those rules:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic