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

RE: Apply-templates - how to omit top level element ta

Subject: RE: Apply-templates - how to omit top level element tags?
From: "Mike Schinkel" <mikes@xxxxxxxxx>
Date: Thu, 8 Sep 2005 18:38:42 -0400
element ta
>> That works but makes things look a lot more complicated than need be.

Why is using one inline in each place I need it more complicated than
having to (and debug and maintain) separate templates in each and every
place where I need <Name/> to be processed?  It seems far more labor
intensive and fragile to do what you suggest.  Why should I go through
the potential that the matches won't occur as I expect when I can just
tell it exactly what I want it to do?

>> No xsl:output doen't affect the output of xml elements (only elements
inno namespace with the names of html elements) html output would have
been the default if <html> had been your top level element but you have
output a top level <How-To-Select> element, was that intentional?

Not intentional, it was a quick and dirty example.

-Mike

-----Original Message-----
From: David Carlisle [mailto:davidc@xxxxxxxxx]
Sent: Thursday, September 08, 2005 6:07 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  Apply-templates - how to omit top level element tags?


				<h1>
					<!-- THIS IS WHAT I NEEDED -->
					<xsl:apply-templates
select="Name/node()"/>
				</h1>


That works but makes things look a lot more complicated than need be.
You probably just want to replace all that by <xsl:apply-templates
select="Name"/>

and have
<xsl:template match="Guide/Name">
 <h1><xsl:apply-templates/></h1>
</xsl:template>

That's probably a more natural xslt coding style.

> Oh, and here's the resultant HTML (I think I needed <xsl:output> to
> omit the XML markup):

No xsl:output doen't affect the output of xml elements (only elements
inno namespace with the names of html elements) html output would have
been the default if <html> had been your top level element but you have
output a top level <How-To-Select> element, was that intentional?
If you intent to have an xml file that carries some html content you do
not want to use the html output method as the result will not be well
formed xml in general (as your example shows meta doesn't have a closing
tag.

David




________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. For more information on a proactive anti-virus
service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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.