One-to-Many condition

Written by Анатолій
Updated 4 days ago

This type of condition can be applied ONLY to a table inside a document. The condition has to return true or false for every row in the table in the following format:

<result>
  <rows>
    <row index='0'>true<row>
    <row index='1'>false<row>
    <row index='2'>false<row>
    <row index='3'>true<row>
  </rows>
</result>

The index attribute has to match the index attribute in the fieldset node. A condition XSLT example:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
        <result>
            <rows>
                <xsl:for-each select="envelope/documents/document[@id='document_id']/fieldgroup[@name='table_name']/fieldset">
                    <row index="{@index}">
                        <xsl:choose>
                            <xsl:when test="field[@name='field_name']='Yes'">
                              true
                            </xsl:when>
                            <xsl:otherwise>
                                false
                            </xsl:otherwise>
                        </xsl:choose>
                    </row>
                </xsl:for-each>
            </rows>
        </result>
    </xsl:template>
</xsl:stylesheet>

For every row where the result = true, a new envelope will be created. To provide xslt map with a proper row index, this map has to be modified accordingly. The following parameter has to be added:

<xsl:param name="row_index"/>

And it can be used in the following way:

<field name="field_name">
    <xsl:value-of select="envelope/documents/document[@id='document_id']/fieldgroup[@name='table_name']/
        fieldset[@index=$row_index]/field[@name='field_name']/@value"/>
</field>
Did this answer your question?