1

I am trying to replace a <t> element using xpath, but it contains a single quote inside the condition. here is what I tried.

      <xpath expr="//t[@t-if='receipt.client and env.pos.company.country and env.pos.company.country.code == 'IN'']" position="replace"/>

How can I do it?

KbiR
  • 4,047
  • 6
  • 37
  • 103
  • 2
    Does this answer your question? [How to use XPath to select text with a quote character?](https://stackoverflow.com/questions/50101617/how-to-use-xpath-to-select-text-with-a-quote-character) – CZoellner Apr 14 '22 at 11:46

2 Answers2

3

There are two solutions for this.

First :

<xpath expr="//t[@t-if=&quot;receipt.client and env.pos.company.country and env.pos.company.country.code == 'IN'&quot;]" position="replace"/>

Second :

<xpath expr="//t[contains(@t-if,&quot;receipt.client and env.pos.company.country and env.pos.company.country.code == 'IN'&quot;)]" position="replace"/>
0

Consider using this form instead :

   <xpath expr="//t[@t-if][1]" position="replace"/>
sylvain
  • 853
  • 1
  • 7
  • 20