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

RE: Unwanted elements in xsl output

Subject: RE: Unwanted elements in xsl output
From: "Rudi Starcevic" <rudi@xxxxxxxxxxxx>
Date: Wed, 9 Jul 2003 21:57:33 +1000
xslt unwanted elements
Hi Jarno,

Thanks,

In my Sam's 24 hours book I can't see a mention of the Built in templates
but after I checked the index of my two new Book's by Jenni I see it clearly.

Thanks for the link too.
Great !

Regards
Rudi.

> Hi,
> 
> > <xsl:template match="/">
> > <html>
> > <head><title>Web app. list</title></head>
> > <body>
> > 	<xsl:for-each select="webapps/website">
> > 		<table border="1" summary="Web Application Table">
> > 		<tr>
> > 			<td>Site Name:</td>
> > 			<td><xsl:value-of select="@name"/></td>
> > 		</tr>
> > 		<xsl:apply-templates/>
> 
> Here you ask to process all the child nodes, including the language element
> 
> > 		</table>
> > 	</xsl:for-each>
> > </body>
> > </html>
> > </xsl:template>
> > 
> > <xsl:template match="address">
> 
> and this will match the address elements
> 
> > 	<tr>
> > 		<td>URL:</td>
> > 		<td><xsl:value-of select="."/></td>
> > 	</tr>
> > </xsl:template>
> 
> but you don't have a template to match the language element. Thus, 
> the build-in template is used to process it, see 
> <http://www.w3.org/TR/xslt#built-in-rule>. The result is that a text 
> node "PHP" will be added to the result tree, without tr and td 
> element wrappers. The HTML DTD doesn't allow PCDATA inside table,
>  thus browser error recovery kicks in; Mozilla recovers by 
> outputting the PCDATA after the table, IE before.
> 
> You can fix your stylesheet by either selecting only the elements 
> you want to process in the / template, i.e. 
> 
>   <xsl:apply-templates select="address" />
> 
> or be adding a template to match the language element and output 
> nothing in it.
> 
>   <xsl:template match="language"/>
> 
> It usually/always helps in debugging if you use a command-line XSLT 
> processor, or an IDE like Xselerator to see what the output is,
>  instead of just looking at the HTML renderation on a browser.
> 
> Cheers,
> 
> Jarno - Razed In Black: Oh My Goth!... aah, the nostalgia
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list




 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.