Skip to main content

Here's the error:

TemplateErrorExists:XPathException: '(./Product_Code[contains(text(), 'ML0015')] and ./Product_Code[contains(text(), 'ML0002')] and ./Product_Code[contains(text(), 'ML0020')] or ./Product_Code[contains(text(), 'ML0021')]' has an invalid token.

Here's the syntax:

<# <Conditional Select=”(./Product_Codedcontains(text(), 'ML0015')] and ./Product_Codedcontains(text(), 'ML0002')] and ./Product_Codedcontains(text(), 'ML0020')] or ./Product_Codedcontains(text(), ’ML0021’)]” Match = “True”/> #><# <Content Select="./All_Products_Name" Optional="true"/>#><# <SuppressTableRow Select=”(./Product_Code.contains(text(), 'ML0015')] and ./Product_Code.contains(text(), 'ML0001')] or ./Product_Code.contains(text(), 'ML0016')] or ./Product_Code.contains(text(), ’ML0017’)]” Match = “True”/> #><# <EndConditional/> #>

Hi there,

I'm not sure what the context of this syntax is in your larger template, but here are a few things to consider:

  1. I see two different statements here: a Conditional Statement/Suppress Table Row statement. On each one is a layer of complexity.
  2. In the SuppressTableRow statement it seems like you are wanting to check if a single product code contains ML0015 AND ML0001 OR ML0016 OR ML0017. I say "single product code" because your SuppressTableRow is looking at an individual row with 1 code. So 1 code will not be able to meet this logic of having both ML0015 AND something else. I am going to assume you wanted to have this be OR for all the product codes listed.

The syntax for this type of scenario would be more like this: Field1 Has a Value Of Value1 Or Value2

  • <# <Conditional Select="//Field1[text() = 'Value1' or text() = 'Value2']" NotMatch="" /> #>
  • <# <Conditional Test="//Field1[text() = 'Value1' or text() = 'Value2']" /> #>

I'm getting this from the "Document Generation Merge Tags" support page.

Let me know if I mis-understood what you were trying to accomplish, and if so, what your specific logic is you're trying to accomplish here.


Hi! This has evolved somewhat since I initially posted. Essentially, this is what I'm looking to do. We need to use SuppressTableRow because these product codes appear in a table:

If ML0015 is present with "ML0001 " OR "ML0016" OR "ML0017" AND "ML0020" OR "ML0021", suppress all.

If "ML0015" is present with "ML0002" AND "ML0020" OR "ML0021", show all except ML0021.

I have a meeting today with docusign support to assist with this, but please feel free to share your ideas! Thank you so much.


I'll let you work with the support team on this. These are pretty specific conditional requirements, and it's hard to convey comprehension via chat messages. As you write your conditional statements, think about how you are grouping your logic.

Other general tips I have:

  1. For complex conditional statements, I find using the "Test" version of the conditionals to be easier to write and validate.
  2. You can use an online xpath tester (such as freeformatter or code beautify) to test your xpath statements with an XML example you provide. YOu can get your XML example by turning on Debug mode on the Doc Gen Config. When you run a test of document generation through to the Preview phase, the XML data file will be saved into the same folder the document would be saved into. With this XML file, you can then do the testing of your xpath expression outside of DocuSign... it's a bit more efficient versus editing the word file & running the merge engine for each test.

Thanks. These tips are super helpful, and I appreciate it. 😊


Reply