5.3. Manipulating XML data with XSLT

5.3.1. Generating loops with XSLT

In this section, we consider some XSLT pages and techniques that can perform some data manipulation of an XML file. First, we will show you how to perform loops on XML data. Based on the loops, a number of basic database operations such as sorting, filtering, and query can be performed.

Another way to display the entire XML page or data is to use the for-each element <xsl:foreach>. This element has the following general form:

   <xsl:for-each select="street/profile">
     xxx
     xxx
   </xsl:for-each>

This statement can read all children of the <profile> element one by one specified by the calling XML document. To construct an example of this feature, you first modify line 2 of ex05-11.xml ...

Get Practical Web Technologies now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.