# Form designer: How to bind XML data to the drop-down list tool

**URL:** <https://discuss.workflowgen.com/t/form-designer-how-to-bind-xml-data-to-the-drop-down-list-tool/253>\
**Category:** Form Designer\
**Created:** [August 29, 2013, 12:07am UTC](https://discuss.workflowgen.com/t/form-designer-how-to-bind-xml-data-to-the-drop-down-list-tool/253 "2013-08-29T00:07:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wfg-admin](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.workflowgen.com/wfg-admin/32/714_2.png) [@wfg-admin](https://discuss.workflowgen.com/u/wfg-admin)\
**Post date:** [August 29, 2013, 12:07am UTC](https://discuss.workflowgen.com/t/form-designer-how-to-bind-xml-data-to-the-drop-down-list-tool/253/1 "2013-08-29T00:07:49Z")

</div>

To use the XmlDataSource data binding feature in the drop-down list tool, you have to define the public URI path of the XML file in the **URL** field, and ensure that the XML is structured so that the properties of each element are expressed as attributes.

Here’s an example of XML file content compatible with the drop-down list databind:

**`http://localhost/wfgen/samples/xmldatasource.xml`**

```auto
<?xml version="1.0" encoding="utf-8" ?>
<NewDataSet>
    <Table1 name="John Doe"/>
    <Table1 name="Bill Smith"/>
    <Table1 name="Jane Brown"/>
</NewDataSet>

```

  
In many cases, XML files that you work with are structured differently. For example, values are often created as elements with inner text.

**`http://localhost/wfgen/samples/users.xml`**

```auto
<?xml version="1.0" encoding="utf-8" ?>
<NewDataSet>
    <Table1>
        <name>John Doe</name>
    </Table1>
    <Table1>
        <name>Bill Smith</name>
    </Table1>
    <Table1>
        <name>Jane Doe</name>
    </Table1>
</NewDataSet>

```

In this case you can provide an XSLT transformation file that can dynamically reformat the XML file so that it is compatible with the XmlDataSource format.

First, create an XSLT file named `users.xsl` and host it on the same URI as the XML file (for example, `http://localhost/wfgen/samples/users.xsl`):

```auto
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
    <xsl:template match="/">
        <xsl:for-each select="NewDataSet">
            <xsl:element name="NewDataSet">
                <xsl:for-each select="Table1">
                    <xsl:element name="Table1">
                        <xsl:attribute name="name">
                            <xsl:value-of select="name"/>
                        </xsl:attribute>
                    </xsl:element>
                </xsl:for-each>
            </xsl:element>
        </xsl:for-each>
    </xsl:template>
</xsl:stylesheet>

```

Then, set its public URI path in the **XSL transform file** field in your drop-down list’s databind settings.

[Download the sample pack](https://app.box.com/s/3d5hfasmojua7w3z3iks49zf9s5x8j14)

For more information, see [http://msdn.microsoft.com/en-us/library/13ftcwy9(v=VS.80).aspx](http://msdn.microsoft.com/en-us/library/13ftcwy9%28v=VS.80%29.aspx).
