Altova Mailing List Archives


Re: [xsl] Apply-templates - how to omit top level element tags?

From: David Carlisle <davidc@--------->
To:
Date: 9/8/2005 10:07:00 PM
<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
________________________________________________________________________

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.