Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用xpath odoo 8在表单标记中添加工作表标记_Xpath_Openerp_Odoo 8_Openerp 7_Openerp 8 - Fatal编程技术网

使用xpath odoo 8在表单标记中添加工作表标记

使用xpath odoo 8在表单标记中添加工作表标记,xpath,openerp,odoo-8,openerp-7,openerp-8,Xpath,Openerp,Odoo 8,Openerp 7,Openerp 8,我需要使用xpath在中添加标记。我尝试了以下代码: <xpath expr="//form[@string='Bank account']" position="inside"> <sheet></sheet> </xpath> 添加的工作表位于表单标记之后 我怎么做呢?请试一试 <xpath expr="//form" position="inside"> <sheet></sheet> &

我需要使用xpath在
中添加标记
。我尝试了以下代码:

<xpath expr="//form[@string='Bank account']" position="inside">
   <sheet></sheet>
</xpath>

添加的工作表位于表单标记之后

我怎么做呢?

请试一试

<xpath expr="//form" position="inside">
  <sheet></sheet>
</xpath>



如果在使用
position=“inside”
时在表单中提供了任何组标记,则会发生的情况是,插入的工作表将作为表单中的最后一项追加。您不需要这样做,您需要的是表单
//form[@string='Bank account']
包含一个工作表,该工作表包含表单的所有子项

查看下面的XPath是否适合您:

<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>

我在这里做的是:

1) 在表单中添加工作表

2) 选择表单中的所有项目(除了我刚才添加的工作表之外),并将它们放在工作表中


3) 为了避免在工作表和外部都有项,我删除了外部项。

我认为字符串在xpath中无效,请尝试使用表单名。expr=“//表单[@name='name of your form']”表单标记没有名称。然后,您需要在xpath中给出表单中特定字段的名称,并给出您需要的前后位置。然后提供实际代码,我根据您问题中的代码回答。您能否解释此
/[not(name()=“sheet”)
。字段不在工作表中。
<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>