Advanced XPath Features

Advanced XPath Features


For more complex scenarios, XPath provides regular expressions, variable assignments, and special functions to manipulate and evaluate XML data dynamically.

This section covers these advanced features.

Working with regular expressions in XPath

Using variables in XPat

Working with regular expressions in XPath

You can use regular expressions with Xpath, if you use the matches Xpath function. This expression checks the variable, MyVariable:

matches($MyVariable, "^(DIN|ISO) A[3-5]$")

 

The regular expression above tests, if the variable:

starts with either 'DIN' or 'ISO'

then a space and the letter 'A'

finish with 3, 4 or 5

 

You can use the expression in IF- and select elements to let the output depend on the result of a test.

 

Remember, that you can combine the XPath functions, and that there are many other functions not mentioned here. This appendix hopefully gives you an idea of how strong a tool this is. You can e.g. refer to this link for additional information: https://www.w3schools.com/js/js_regexp.asp


Using variables in XPath
XPath is a strong tool so you can even use variables in your XPath expressions. 
More detailed information about variables can be found here

 

    Notice: Help Center Transition Update

    As of January 13, 2025, we are excited to announce that our new Help Center is in the final stages of development. While the Knowledge Base is already accessible, our current JIRA system will continue to manage support tickets during this transition period. For assistance with InterForm Output Management Software, please refer to the Support for InterForm Output Management Software.

    We appreciate your patience and understanding as we work to enhance your support experience. If you have any questions or encounter any issues, please do not hesitate to reach out via the existing support channels.

    Best regards,
    The InterForm Support Team


      • Related Articles

      • XPath

        In InterFormNG2, you use the language XPath for referencing data from the XML file. There are many sources of information if you want to learn more about XPath, but you can also simply read the few examples below to get a good idea of how it can be ...
      • Node Existence & Conditions

        XPath allows you to verify the existence of nodes, check if they contain data, count occurrences, and ignore namespaces. This section covers essential techniques for validating and filtering XML elements. Calculating the sum of nodes Counting ...
      • XPath wizard

        When you in InterFormNG2 insert a value in a field, then you for most have these options: 1.You can insert a fixed text. 2.You can type a dynamic XPath expression where you need to remember each XPath function and the matching parameters. 3.For some ...
      • Set one workflow variable

        The advanced set meta data workflow component, Set one workflow variable, sets/defines a workflow variable. This can be used later in the workflow and also in a template in the designer. The variable can be referenced in XPath expressions with a ...
      • Using variables in Xpath expressions

        XPath is a strong tool in itself, but you can even use variables in your XPath expressions. The way it works is by referring to a variable as: $variable You use the variable element to assign a value to a variable. Variables are case-sensitive, so ...