In this recipe, we will examine the usage of the
for-each command in XSLT. This function is helpful when we need to transform a number of identical elements in the array. We will use the
for-each command to map (transform) the list of the available cars.
We will modify the example from the The chaining functions recipe. For our recipe, we will define a new schema to show how the
for-each command works. We define a schema that presents a list of the available cars to be rented. The schema is as follows:
<xsd:element name = "WScars"> <xsd:complexType> <xsd:sequence> <xsd:element name = "listCars" maxOccurs = "unbounded"> <xsd:complexType> <xsd:sequence> <xsd:element name = "carType" type = "xsd:string"/> ...