Property "Repeat | Parameters for Inner Repeats" <xslparms>

Top  Previous  Next

The "Repeat | For Each" property is used to select the required XML nodes. If all the nodes required are accessible relative to the selected node then "Parameters For Inner Repeats" property is not required.

The Syntax

 

parameter-name:node-selection[;parameter-name:node-selection]

 

Example: "Parameter For Inner Repeats" Property is not used

XML Data:

 

 

 <root>

  <products>

    <category>White Goods</category>

    <product id="10001">

      <name>Refrigerator</name>

    </product>

    <product id="20002">

      <name>Microwave Oven</name>

    </product>

  </products>

 </root>

 

 

Repeat Properties of the container element:

 

without_inner_pe

 

The elements in the container:

 

without_inner_for

 

The Result:

without_inner_result

But if we want to access the XML nodes which are not directly accessible from the selected node we need to use "Parameters for Inner Repeat" property.

 

Example: "Parameter For Inner Repeats" Property is used

 

XML Data:

 

 

 <root>

  <courses>

    <item>

      <id>1</id>

      <name>Java Programming</name>

      <teacher>John Doe</teacher>

    </item>

    <item>

      <id>2</id>

      <name>C++ Programming</name>

      <teacher>Minny Driver</teacher>

    </item>

  </courses>

  <students>

    <item>

      <name>Mary Joe</name>

      <course_id>1</course_id>

    </item>

    <item>

      <name>Michael Sample</name>

      <course_id>1</course_id>

    </item>

    <item>

      <name>Edith Burque</name>

      <course_id>2</course_id>

    </item>

  </students>

 </root>

 

 

 

Repeat Properties of the container element:

 

inner_repeat_prop

 

The elements in the container:

 

for_inner_repeat_design

The result:

for_inner_repeats

The Explanation:

 

The first text element in the container is bind to the name of the student. The second one is bind to the course the student is attending with definition

/courses/item[id = $id]/name

 

This definition queries the /courses/item nodes whose id node value is equal to $id. The XSL variable $id contains the course Id of the student as the result of id:course_id definition made within the "Parameter For Inner Repeats" Property.

See Repeat Property.