|| -----Original Message----- || From: [EMAIL PROTECTED] || [mailto:[EMAIL PROTECTED] On Behalf Of Ronald Bourret || Sent: woensdag 26 februari 2003 19:03 || To: [EMAIL PROTECTED] || Subject: Re: Tests and other things || || Just to be clear. The following should be legal: || || <xupdate:insert-before(after) ...> || <xupdate:attribute .../> || </xupdate:insert-before(after)> || || That is, I should be allowed to use a pretty-printed || document when inserting an attribute. It is up to the || implementation to ignore the whitespace surrounding the || xupdate:attribute element.
Ok, so: this is legal: <xupdate:insert-before(after) ...><xupdate:attribute .../></xupdate:insert-before(after)> and is considered the same as this: <xupdate:insert-before(after) ...> <xupdate:attribute .../> </xupdate:insert-before(after)> This would be illegal (assuming insert-before(-after) selects an attribute) <xupdate:insert-before(after) ...> <xupdate:attribute .../> <xupdate:text>bla</xupdate:text> <!-- or any other constructor element not the same as xupdate:attribute --> </xupdate:insert-before(after)> || > Also, insert-before(-after) operations selecting elements || should in my || > opinion not contain <xupdate:attributes> constructor || elements because || > I see no logic in inserting attribute before (or after) || elements. At || > the moment Lexus allows you to do it but it appends the || attribute to || > the parent of the selected element, not very logical. || || Agreed? See next comment. || || I just re-read the two statements above, and it seems that, || in order to insert a new attribute, I have to use an XPath || selector that selects an existing attribute. Is this || correct? If so, how do I add an attribute to an element || that doesn't have any attributes? To append an attribute to existing element you use: <xupdate:append select="/some/element"> <xupdate:attribute name="bla">something</xupdate:attribute> </xupdate:append> Note that the whitespaces before and after <xupdate:attribute/> are appended to the /some/element You can see this in action here: http://support.x-hive.com/xupdate/index.html by pasting this xupdate query in the query field: <?xml version="1.0"?> <lexus:modifications version="1.0" xmlns:lexus="http://www.xmldb.org/xupdate"> <lexus:append select="//[EMAIL PROTECTED]'Lars']/town"> <lexus:attribute name="bla">something</lexus:attribute> </lexus:append> </lexus:modifications> Writing this I realise that there is another (simple) solution to this problem; insert-before(-after) operations are not allowed to select attributes just like append operations are only allowed to select elements. Seems a logical thing to do since the XML spec doesn't specify an order in the attributes anyway. Any thoughts? Jeroen -- X-Hive Corporation e-mail: [EMAIL PROTECTED] phone: +31 10 2818080 http://www.x-hive.com ---------------------------------------------------------------------- Post a message: mailto:[EMAIL PROTECTED] Unsubscribe: mailto:[EMAIL PROTECTED] Contact administrator: mailto:[EMAIL PROTECTED] Read archived messages: http://archive.xmldb.org/ ----------------------------------------------------------------------
