# ​One-to-Many Condition

Use this condition type only for tables inside a document. It must return `true` or `false` for each table row in this format:

```markup
<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 must match the `index` attribute in the `fieldset` node.

Example condition XSLT:

```markup
<?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 each row where the result is `true`, the system creates a new envelope. To pass the row index into the XSLT mapping, add this parameter:

```markup
<xsl:param name="row_index"/>
```

Use it like this:

```markup
<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>
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://support.docstudio.com/user/scenarios/condition-types/one-to-many-condition.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
