--- title: "How Do I Use X-Path Expressions in XML Conditional Patterns?" slug: "how-do-i-use-x-path-expressions-in-xml-conditional-patterns" description: "The Lasernet Form Editor allows for the use of Patterns to identify line items. Patterns can be defined based on the Start pattern criterion. " updated: 2026-03-04T09:06:31Z published: 2026-03-04T09:06:31Z canonical: "kb.lasernetgroup.com/how-do-i-use-x-path-expressions-in-xml-conditional-patterns" --- > ## Documentation Index > Fetch the complete documentation index at: https://kb.lasernetgroup.com/llms.txt > Use this file to discover all available pages before exploring further. # How Do I Use X-Path Expressions in XML Conditional Patterns? The Lasernet Form Editor allows for the use of Patterns to identify line items. Patterns can be defined based on the **Start pattern criterion**. The start pattern criterion can be defined simply by using the XPath for each line item. However, expressions can be used within the Start pattern criterion to further specify which lines to pick up. This article provides a guide on how to build conditionals for **Start pattern criteria** by showing examples. > [!NOTE] > Note > > XPATH is a query language for selecting nodes from an XML document. XPATH was not invented or created by the Lasernet Group, but it is used by Lasernet Form Editor. You will require a good knowledge of X-PATH rules because certain operators you may want to use are not allowed in X-Path, for example, Negative number comparisons. ## Examples The examples used in the article will be for a project invoice with five lines. This is a basic **Start pattern criterion** that validates the XPath existence so it can identify all the lines of this project invoice. As shown, this example has five lines, two of which are type **Item**, two of type **Hour**, and one of type **Expense**. ![](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/XML-Patterns-1-annotated.png) ### Validate a Specific Field Add square brackets to the end of the XPath, followed by the complete field name, an operator, and your value to check for a specific field within the pattern. This pattern is using the **=** operator, but you can also use **<>** to check that the fields do NOT equal the value. Example: Only show invoice lines of transaction type **Hour**. ![](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/XML-Patterns-2-annotated.png) The following is another example of validating a specific field. In this case, the field is a number and so we can use operators like **>** or **<**. Example: Only show invoice lines with a line amount greater than **0**. ![](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/XML-Patterns-3-annotated.png) ### Specify which Line Number to Print Add square brackets to the end of the XPath, followed by the line number you wish to display. Example: Only show the 5th invoice line. ![](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/image-H9TV4BXJ.png) ### Combine Different Conditions Add multiple conditions by defining each one within square brackets. In this case, you are not using operators but the behavior is similar to using an **AND** operator. These conditions must all be true for the line to pass the criterion. Example: Only show invoice lines of transaction type **Item** with a quantity greater than **1**. ![](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/image-V01ZYSJ3.png) Add multiple conditions within the same square brackets and combine them using **and**. All conditions before and after the **and** must be true to pass the criterion. Example: Only show invoice lines of transaction type **Item** with a quantity greater than **1**. ![](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/image-D3X0GJVS.png) Add multiple conditions within the same square brackets and combine them using **or** At least one of the conditions before or after the **or** must be true to pass the criterion. Example: Only show invoice lines that are either transaction type **Item** or have a quantity greater than **1**. ![](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/image-3GVV59EQ.png) The following are two examples of a start pattern criterion that combines **and** and **or**. Best practice when combining **and** and **or** is to use parenthesis to group conditions. Both start pattern criteria are the same, except for the difference in the placement of the parenthesis. Example: Only show invoice lines that are transaction type **Hour** **or** Show invoice lines that have a quantity greater than **1 and** a description of **MidRangeSpeakers** We get the hour lines displayed because they meet the condition before the **or** operator. We also get the item line because, while it is not type **Hour**, it does have a quantity greater than **1** and a description of **MidRangeSpeaker**. ![](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/image-Q8IOJKKT.png) Example: Only show invoice lines that are either transaction type **Hour** or that have a quantity greater than **1**. These lines must also have a description of **MidRangeSpeakers**. We get one line that matches this criterion. The line has a quantity greater than **1** and a description of **MidRangeSpeakers**. ![](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/image-E0FZ2ZAU.png) Attached is an object file and a grab file from the examples presented in this article to use for testing/ practice. [](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/StartPatternExample.lnobjectx)StartPatternExample64.02 KB[](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/StartPatternExample.lnobjectx)[](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/3C3B7MOYDPNU5LQLWEK5CIFV4U.xml)3C3B7MOYDPNU5LQLWEK5CIFV4U23.36 KB[](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/3C3B7MOYDPNU5LQLWEK5CIFV4U.xml)