Re: Inserting an attribute with xforms:insert

Posted by Ryan Puddephatt on
URL: https://discuss.orbeon.com/Inserting-an-attribute-with-xforms-insert-tp33086p33091.html

Joseph,
    This will copy all the attributes that exist, but Larry wants to create an attribute from an element

Larry,
    I'm not sure if this is the only way, but I would create a template instance with my attribute in it

<xforms:instance id="template-instance">
    <instance some-attribute=""/>
</xforms:instance>

Then you can insert this attribute, using xforms:insert and set its value using xforms:setvalue

Hope this helps

Ryan

Joseph Lawrence wrote:
Hi Larry,
    Hopefully the following modification in your code might work.

<xforms:insert nodeset="@*" position="after" at="1"
origin="instance('my-attribute')/@attr1"/>

    If in case it doesn't, please check whether the sample I am attaching suits your requirement.
    In the attached sample you have a repeat contol and two trigger controls. 1st trigger control is for inserting a node, which once inserted shows up in the list generated by the repeat control.
    The 2nd trigger control inserts an attribute with the value we input to the node selected by the repeat control. In case such an attribute already exists an alert message will be shown.

Thanks
Joseph Lawrence
Stabilix Solutions

"Larry T. Chen" [hidden email] wrote:
Alex,

I've been using this sort of insert with nodeset pointing to an element.  I'm basically trying to create an attribute on an element if it doesn't already have that attribute.  Should nodeset be pointing to an attribute instead?  But then wouldn't it be impossible to insert an attribute if it doesn't already exist?

Larry


Alessandro Vernet wrote:
Hi Larry,

Yes, there were changes very recently in the specification related to
the <xforms:insert>. In your example, what does nodeset point to? Is
it another attribute or an element?

Alex

On 3/12/07, Larry T. Chen [hidden email] wrote:
Hi All,

Inserting an attribute using something like

<xforms:insert nodeset="." position="after" at="1"
origin="instance('my-attribute')/@attr1"/>

used to work in the nightly builds some weeks before the 3.5 release.
Since I upgraded to the 3.5 release, insert actions of this sort stopped
working.
Does anybody know if there was a change to the specs of how
xforms:insert works?  Am I missing something in the insert action?

Larry




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: [hidden email]
For general help: [hidden email]
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws





-- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: [hidden email] For general help: [hidden email] ObjectWeb mailing lists service home page: http://www.objectweb.org/wws


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: [hidden email]
For general help: [hidden email]
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws


We won't tell. Get more on shows you hate to love
(and love to hate): Yahoo! TV's Guilty Pleasures list.

-- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: [hidden email] For general help: [hidden email] ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

--

Ryan Puddephatt
Software Engineer
 
Teleflex Group - IT UK
1 Michaelson Square
Livingston
West Lothian
Scotland
EH54 7DP
 
e> [hidden email]
t> +44(0)1506 407 110
f> +44(0)1506 407 108
w> www.teleflex.com



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws