Message51

Author paul
Recipients paul, wichert
Date 2008-02-14.09:44:00
Content
On Feb 13, 2008, at 11:51 AM, Ian Bicking wrote:

> Paul Everitt wrote:
>> Have you confirmed that this doesn't work?  Meaning, if you write  
>> an  XPath expression that selects attributes, they don't get copied?
>
> Last I checked this (and this still seems to be true in lxml 2) you  
> can't very usefully select attributes; you just get a list of the  
> attribute values back.  So if you did something like:
>
> <copy content="//div[@id='content']/@class" theme="/html/body" />

I tried my XPath foo yesterday and found I could get a list of  
attributes, but was getting the values of the attributes, not the  
nodes.  While I could probably find some heinous XPath expression, it  
makes me wonder about the nature of the problem.

> There'd be no way to tell what attribute you were trying to copy  
> over when the expression is evaluated.
>
> I think to do this there'd have to be some modifier on the  
> expression, to indicate that you want to take the attributes off the  
> selected element.  And maybe you don't want to copy attributes, but  
> rather merge classes?

This is my big question for Wiggy.  If you want the attributes from  
the content, you can just copy over the div.  Do you really need to  
merge the attributes from two nodes into just one node in the theme?

--Paul
History
Date User Action Args
2008-02-14 09:44:01 paul set recipients: + paul, wichert
2008-02-14 09:44:01 paul link issue23 messages
2008-02-14 09:44:00 paul create