On Fri, 30 Nov 2001 09:45:18 -0500 "Jonathan Borden" <[EMAIL PROTECTED]> wrote:
> Lars, > > some days ago somebody asked about how to update an attribute of a > > given element. If the attribute node already exists then this is > > no problem with XUpdate: > > > > <xupdate:modifications xmlns:xupdate="..."> > > <xupdate:update select="/xpath/to/[EMAIL PROTECTED]"> > > new value > > </xupdate:update> > > </xupdate:modifications> > > > > Updating a possibly non-existent attribute (as well as element) is > > somewhat difficult, because this is not the use case of XUpdate. > > Either one inserts (after|before) or append an element|attribute node > > or one updates an existing element|attribute node. Its not possible > > (with justifiable expense) to find out whether the selected node does > > not exist or a node en route. But we need to know exactly this to > > decide whether to create the node (i.e. update with implicite creation) > > or not. > > > > Or did I ignore some other facts? > > > > Careful here, > > select="/xpath/to/[EMAIL PROTECTED]" > > selects the _element_ node which has a the attribute (node) > > select="/xpath/to/node/@attribute" selects the attribute (node) You're right. Please forgive my inaccuracy. I'm sure people did observe my failure. ;-) Lars. -- ______________________________________________________________________ Lars Martin mailto:[EMAIL PROTECTED] SMB GmbH http://www.smb-tec.com ---------------------------------------------------------------------- Post a message: mailto:[EMAIL PROTECTED] Unsubscribe: mailto:[EMAIL PROTECTED] Contact administrator: mailto:[EMAIL PROTECTED] Read archived messages: http://archive.xmldb.org/ ----------------------------------------------------------------------