I need add tag <sheet>
inside <form>
using xpath. I have tried below code:
<xpath expr="//form[@string='Bank account']" position="inside">
<sheet></sheet>
</xpath>
The sheet added but after the form tag.
How can i do it?
I need add tag <sheet>
inside <form>
using xpath. I have tried below code:
<xpath expr="//form[@string='Bank account']" position="inside">
<sheet></sheet>
</xpath>
The sheet added but after the form tag.
How can i do it?
please try
<xpath expr="//form" position="inside">
<sheet></sheet>
</xpath>
or
<xpath expr="//form/group[1]" position="before">
<sheet></sheet>
</xpath>
if you gave any group tags inside form
When you use position="inside"
what happens is that the sheet you are inserting is appended as the last item inside of your form. You do not need that, what you need is for the form //form[@string='Bank account']
to contain a sheet and that sheet to contain all the children of the form.
See if the xpaths below work for you:
<xpath expr="//form[@string='Bank account']" position="inside">
<sheet>
<xpath expr="//form[@string='Bank account']/[not(name()='sheet')]"/>
<xpath expr="//form[@string='Bank account']/[not(name()='sheet')]" position="replace"/>
</sheet>
</xpath>
What I do here is:
1) Add the sheet inside the form
2) Select all the items in the form(besides the sheet I just added and put them inside the sheet.
3) To avoid having items both in the sheet and outside, I remove the outside.