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

Re: Default Rendering of HTML?

Subject: Re: Default Rendering of HTML?
From: Shawn <sgrover@xxxxxxxxxxxxxx>
Date: Sun, 21 Nov 2004 13:42:46 -0700
xsl value of html
I've have partial success now.

I tried two methods.  First I tried the <xsl:output> like so:

<xsl:output
	method="html"
	version="4.0"
	omit-xml-declaration="yes"
	cdata-section-elements="text"
	indent="yes"
/>

This didn't really make any difference.  Then while researching how to handle 
HTML tags in XML, I came across a reference that used xsl:copy-of, instead of 
value-of.  It occurred to me that what I was trying to do was place the 
entire node into my output, so copy-of was what I should be using.  So, I 
changed the <xsl:value-of select="text"/> line of my XSL to read <xsl:copy-of 
select="text"/> - and suddenly my HTML began to work.

I had two nodes that were to get rendered, but the first (which didn't contain 
HTML tags) didn't.  I resolved this by removing the <xsl:output> tag I had 
tried earlier.

So, I have a working solution.  But, I'm not sure if this is going to be 
suitable in all cases with HTML tags embedded in XML, or if there is a better 
way of doing this.  Any suggestions are appreciated.

Shawn

On Sunday 21 November 2004 13:13, Shawn wrote:
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> 	<xsl:template match="/news">
> 		<xsl:apply-templates/>
> 	</xsl:template>
>
> 	<xsl:template match="item">
> 		<p>
> 			<span>
> 				<xsl:attribute name="class">newsDate</xsl:attribute>
> 				<xsl:value-of select="date"/>
> 			</span>
> 			<br/>
> 			<span>
> 				<xsl:attribute name="class">newsTitle</xsl:attribute>
> 				<xsl:value-of select="title"/>
> 			</span>
> 			<br/>
>
> 			<xsl:value-of select="text"/>
> 		</p>
> 	</xsl:template>
> </xsl:stylesheet>

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.