Property "Repeat | For Each" <foreach>

Top  Previous  Next

This property is used to query the XML nodes for which the container element will be repeated.

For example, to repeat a container element for each <item> in <products>;
 

 

  <root>

    <products>

      <item>

        <id>P0017</id>

        <description>Notebook Computer PIII 800Mhz</description>

        <price>1200</price>

      </item>

      <item>

        <id>P0908</id>

        <description>Laser Printer 1200dpi, 12pps</description>

        <price>800</price>

      </item>

    </products>

  </root>

 

 

We should set the "Repeat | For Each" property as "/products/item"

If you omit the root tag name MoreMotion Application Studio will assume that it is the value defined with "XML Root Tag Name" property of page element. If not otherwise specified the value is "<root>" by default.

/root/products/item

 

and

/products/item

 

will do the same job.

If the root tag in your XML document is different than "root" you can set it using "XML Root Tag Name" property of the page.

The Syntax

The syntax that is used in definition of this property is nothing but XSL.

  <xsl:for-each select="the value of property is put here...">

    ...

  </xsl:for-each>

 

Therefore its capabilities is only limited with XSL.

Examples:

/products/item

/products/item[price > 1000]

//item[id = 'P0017']

 

 

See Also

Repeat Property

More Query Samples

Parameters For Inner Repeats Property