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

RE: how to <xsl:apply-templates /> for ELEMENT nodes o

Subject: RE: how to <xsl:apply-templates /> for ELEMENT nodes only?
From: <Jarno.Elovirta@xxxxxxxxx>
Date: Tue, 30 Mar 2004 10:51:41 +0300
RE:  how to <xsl:apply-templates /> for ELEMENT nodes o

> At the moment, I have
>   <!-- lots of imported templates in this XSL file -->
>   <xsl:template match="/">
>    <html>
>     <head>
>      <title>UC Policy Database</title>
>      <link rel="StyleSheet" type="text/css" 
> href="policydb_content.css"/>
>     </head>
>     <body leftmargin="0" topmargin="0" marginwidth="0" 
> marginheight="0">
>      <xsl:call-template name="header"/>
>      <xsl:apply-templates select="//menu" mode="menu"/>&#xa0;	

The same advice as always, using // is expensive and you should avoid it if you can.

> <xsl:apply-templates />
>      <xsl:call-template name="footer"/>
>     </body>
>    </html>
>   </xsl:template>
> But in order to stop the text node from being spewed out by 
> default, I 
> have to explicityly surpress it with
> <xsl:template match="//text()" />

Simple "text" will suffice.

> While this works, surely there is a more elegant way. The source XML 

There's nothing inelegant about your solution. The other approach, possibly preferable, is that you don't select the nodes you don't want to be processed. That is, instead of

  <xsl:apply-templates />


  <xsl:apply-templates select="*" />

or what ever the content model contains.


Jarno - Epsilon Minus: Freedom

Current Thread


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.
First Name
Last Name
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.