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

RE: XSLT/XPATH 2.0 - except example.

Subject: RE: XSLT/XPATH 2.0 - except example.
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 22 Jul 2009 22:01:00 +0100
RE:  XSLT/XPATH 2.0 - except example.
<xsl:copy-of select="* except X"/>

means "make an exact copy of all the children, except any child selected by
the expression X (which should not be copied at all).

I suspect you are misunderstanding it to mean "copy all the children,
modifying them as you do so to leave out any nodes selected by X".

Clearly that doesn't work: the select expression selects all the children,
then unselects some of them, then xsl:copy-of copies all those that remain.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 

 

> -----Original Message-----
> From: Knight, Michel [mailto:michel.knight@xxxxxxxx] 
> Sent: 22 July 2009 21:45
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  XSLT/XPATH 2.0 - except example.
> 
> Using Saxon 9
> Windows
> XSLT/XPATH 2.0
> 
> Hi,
> 
> I'm trying to remove the h1 from my source with the "except" 
> and it doesn't work.
> ex:<xsl:copy-of  select="* except
> (//xhtml:div[@class='border']//xhtml:h1)" />
> 
> When I do the same logic to class=border section it work?? 
> <xsl:copy-of  select="* except(//xhtml:div[@class='border'])" />	
> 
> What I'm I missing, with the except for the removal of that 
> section h1???
> Note: source code included.
> Regards,
> 
> Michel
> 
> ---------------   My StyleSheet
> <xsl:strip-space elements="*"/>
> <xsl:template match="xhtml:html" exclude-result-prefixes="xhtml" >
> 
> <root>
> 			<content>
> 				<xsl:apply-templates
> select="//xhtml:div[@class='center']"  
> exclude-result-prefixes="xhtml"/>
> 
> 			</content>
> </root>
> </xsl:template>
> <!--
> ==============================================================
> =========
> -->
> <!--*****************************************-->
> <!-- Content section just remove the right nav-->
>   <xsl:template match ="//xhtml:div[@class='center']"
> exclude-result-prefixes="xhtml">
> 		<!-- Right Nav first-->
> 		Remove h1
>             <!-- THIS doesn't WORK, why????? --> 	       
> 			<xsl:copy-of  select="* except
> (//xhtml:div[@class='border']//xhtml:h1)" />				
> 	    END of remove h1
>             <!-- THIS WORK --> 	       
> 	       <xsl:copy-of  select="*
> except(//xhtml:div[@class='border'])" />	
>   </xsl:template>
> <!--*****************************************-->
> </xsl:stylesheet>
> 
> ---------------   My Source
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" ""> 
> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" 
> xml:lang="en"> <head> </head> <body> <!--googleoff:all--> 
> <div class="page"> <div class="center"> <div class="border"> 
> <h1> <a name="cont" id="cont">  Aviation Security </a>  </h1> 
> <p>The Government of Canada has committed more than programs 
> include the following:</p> </div> </div> </div> </body> </html>

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.