[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Problem Translating 'escaped' HTML tags to real HTML

Subject: Problem Translating 'escaped' HTML tags to real HTML
From: "Davies, Paul (FNB)" <DaviesPa@xxxxxxxxx>
Date: Thu, 3 Oct 2002 13:14:54 +0100
escaped html tags
Hi,

I need to translate an XML doc to HTML. The XML contains HTML tags in the
format &lt;br&gt; This needs to be translated such that it is seen as a line
brake tag by the browser.

I have tried the following search-replace template:

<xsl:template name="BR">
  <xsl:param name="stringIn"/>
  <xsl:choose>
   <xsl:when test="contains($stringIn, '&lt;br&gt;')">
      <xsl:value-of select="substring-before($stringIn, '&lt;br&gt;')"/>
	<br/>
      <xsl:call-template name="BR">
          <xsl:with-param name="stringIn" select="substring-after($stringIn,
'&lt;br&gt;')"/>
      </xsl:call-template>
   </xsl:when>
   <xsl:otherwise>
	<xsl:value-of select="$stringIn"/>
   </xsl:otherwise>
   </xsl:choose>
</xsl:template>

however the returned text does not contain the <br/> tags!!?? If I
substitute this text for non HTML (eg AAA) this IS inserted into the input
string.

I have tried using an xsl:element tag: <xsl:element>br</xsl:element>. This
is ignored too.

I have also tried to use an xsl:text tag: <xsl:text><br></xsl:text> and
<xsl:text>[CDATA[<br>]]</xsl:text>. Both of these result in a SAX exception
stating the a br tag is not legal in this location. (I amusing Xalan-J2.4.0
and the example servlet 'SimpleXSLTServlet' to perform the translation.

Ideally I would like to simply translate all &lt; to < and all &gt; to > ,
so all the HTML tags in the XML get displayed properly.

cheers

Paul Davies

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.