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

Re: Need help rendering the HTML residing within the X

Subject: Re: Need help rendering the HTML residing within the XML
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 12 Aug 2004 14:02:25 +0100
Re:  Need help rendering the HTML residing within the X
Hi Jeremy,

> I need my XSL file to parse the XML so that the browser (IE 6+, NN
> 7+) will take these <b></b> tags and apply the appropiate HTML
> formatting rather than treating them as XML nodes.

Make sure that you've designed your stylesheet to use
<xsl:apply-templates> rather than <xsl:value-of>. For example, you
should have a template like:

<xsl:template match="name">
  ...
  <xsl:apply-templates />
  ...
</xsl:template>

Given that, all you need to do is add a template that copies <b>
elements (and other HTML elements) into the output:

<xsl:template match="b">
  <b><xsl:apply-templates /></b>
</xsl:template>

Note that you should apply templates to the content of the <b>
elements in case they contain other elements nested inside them that
you also want to copy.

You *could* place the HTML elements in a separate namespace, but
there's no need to.

> The browser seems to like character entity equivalents such as in
> line 2 below and renders the <name> node in bold when I have
> disable-output-escaping set to "yes".

Don't do it this way. It's ugly, might not work in all processing
environments, and there's a much better and simpler way (above) that
doesn't require any change to the source.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

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.