ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> xsl-list
xsl-list
RE: [xsl] Collecting attributes from the ancestor-or-self axis
by WATKIN-JONES,ADAM (HP-UnitedKingdom,ex1) other posts by this author
Nov 19 2001 11:38AM messages near this date
Re: [xsl] Collecting attributes from the ancestor-or-self axis | Re: [xsl] Collecting attributes from the ancestor-or-self axis
Thanks David,

Wow, that saves a lot of typing!

I believe this works as follows:
1. the select in copy-of returns a node-set in document order.  At this
point the node set has duplicate attribute names.
2. when copy-of applies these attributes to the output element, the
duplication is removed by succeeding attribute nodes overwriting the values
of any attributes that are already present.

This all seems awfully convenient!  (But I'm not complaining :)

Regards,
Adam


>  From: David Carlisle
>  
>  >I am trying to write some XSLT to do the following:
>  >
>  >1. start at element E
>  >2. add all its attributes to the output
>  >3. move to E's parent, EP
>  >4. add to the output all those attributes
>  >   of EP that do not have the same name as
>  >   as an attribute already added to the output
>  >5. move to EP's parent and so on collecting
>  >   new attributes until I've reached the last
>  >   ancestor of P.
>  
>  this is a ___lot___ easier than you think:-)
>  
>  <xsl:copy-of select="ancestor-or-self::*/@*"/>
>  
>  does exactly that.
>  
>  David
>  

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
Thread:
WATKIN-JONES,ADAM (HP-UnitedKingdom,ex1)
Oleg Tkachenko
Jeni Tennison
David Carlisle
David Carlisle

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved