Hi, I'm trying to delete an attribute from an element, but having no luck. I'm about 99% confident that my xpath is correct, is this a bug?
Here is a short example of my code: <xforms:repeat nodeset="instance('metadata')/mods:titleInfo" id="titleInfo"> <xforms:input ref="@displayLabel"> <xforms:label class="mods-label">Display Label: </ xforms:label> </xforms:input> <xforms:trigger class="delete" appearance="minimal"> <xforms:label>remove</xforms:label> <xforms:action ev:event="DOMActivate"> <xforms:delete nodeset="@displayLabel" at="index('titleInfo')"/> </xforms:action> </xforms:trigger> </xforms:repeat>
relevant XML snippit: <mods:mods> <mods:titleInfo type="abbreviated" authority="lcsh" displayLabel="title"> <mods:title>Sound and fury :</mods:title> <mods:subTitle>the making of the punditocracy /</ mods:subTitle> <mods:nonSort>the</mods:nonSort> </mods:titleInfo> </mods:mods>
> I'm trying to delete an attribute from an element, but having no luck. > I'm about 99% confident that my xpath is correct, is this a bug?
I believe that the problem is that you don't need the "at" attribute on your delete. In that context, the nodeset will have exactly one node (the desired attribute); the "at" attribute may evaluate to a number greater than one. You generally want to use the "at" attribute with the "index" function when you're selecting the currently indexed element node from a repeat.
Cleveland Clinic is ranked one of the top hospitals in America by U.S. News & World Report (2007). Visit us online at http://www.clevelandclinic.org for a complete listing of our services, staff and locations.
Confidentiality Note: This message is intended for use only by the individual or entity to which it is addressed and may contain information that is privileged, confidential, and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please contact the sender immediately and destroy the material in its entirety, whether electronic or hard copy. Thank you.
I'm responding to you and the mailing list; it looks like you may have forgotten to include the mailing list with your response.
> Thanks for the suggestion, unfortunately removing the at > attribute did not help. Also, I'm pretty sure I would need it > as the attribute I'm trying to delete is located within a > repeating nodeset. Any other thoughts? Has anyone else run > into problems deleting attributes?
I constructed a sample form based upon your original message:
This form seems to have the behaviour for which you were looking. It also works without the "at" attribute (and I still think that *not* including the "at" attribute is the correct approach). Can you see if this form works with your version of the Mozilla Xforms Extension? If it does, then we may need more information to try to determine why your actual form isn't working.
Take care,
John L. Clark
===================================
Cleveland Clinic is ranked one of the top hospitals in America by U.S. News & World Report (2007). Visit us online at http://www.clevelandclinic.org for a complete listing of our services, staff and locations.
Confidentiality Note: This message is intended for use only by the individual or entity to which it is addressed and may contain information that is privileged, confidential, and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please contact the sender immediately and destroy the material in its entirety, whether electronic or hard copy. Thank you.
> This form does not work with my version of the extension. I'm > using .0.8.0.3, what version did you test this with?
I've been testing one of the recent nightly branch builds (2007-08-09-03[0], to be precise). I didn't think there had been any fixes to the delete functionality, but apparently I was wrong. It looks like bug 387738[1] might be related to your problem. You may want to give a nightly branch build a try; I've found them to be pretty stable. If you do, you probably want to go with the latest one[2].
Cleveland Clinic is ranked one of the top hospitals in America by U.S. News & World Report (2007). Visit us online at http://www.clevelandclinic.org for a complete listing of our services, staff and locations.
Confidentiality Note: This message is intended for use only by the individual or entity to which it is addressed and may contain information that is privileged, confidential, and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please contact the sender immediately and destroy the material in its entirety, whether electronic or hard copy. Thank you.