Example 1: Display the List of Brands by Inline API Calls

The example below demonstrates how to display the list of brands by inline API calls:

<select id="brand">

 <!--{foreach X.get('//ul[@id="vendors"]/li') as item }-->

           <option value="<!--{= X.value('@data-vendor-id', item) }-->">

               <!--{= X.value('.', item) }-->

           </option>
 <!--{/foreach}-->

</select>

This code generates dropdown box with options taken from the LI elements of the original page.The declared item object is used as a context in the X.value() API function as a second parameter.