Sea Side Scrap Book

Subscribe to RSS feed

Iteration Using For-each In XSLT

Extensible Stylesheet Language (XSL) is an XML-related technology which is used to transform XML data. XML file are used to set the ground-rules for a given body of data and to describe the data itself. XSL allows us to take that data and convert it into information which can be displayed in a web browser window or opened with a text editor. It can also be used to create an XML file which is a modified version of an original XML file.

When displaying elements in a browser window, the XSL elements which allow us to loop through an XML tree and carry out decision-making really come into their own. One of the key methods used in XSL for looping through all occurrences of a given XML element is the “For-each” element. This uses the “select” attribute to specify which XML element is to be used in the loop. The “For-each” element uses both an opening and a closing tag and any lines of code placed between the opening and closing tags will be repeated each time the element specified in the “select” attribute is encountered in the XML file.

For example, suppose we have an XML file containing a list of companies and the addresses of their websites. Suppose, as well, that the element which we will be targeting in the XSL “For-each” statement is called “company” and that, within each company element, we have a “name”, “telephone” and “website” element. Before starting our “For-each” loop, we could place the opening tag of an HTML “ul” element (an unordered or bulleted list).

Home furniture For The Green Thumb is another wonderful article

Inside the “For-each” loop, we could output an HTML “li” element and, between the opening and closing tag, output the contents of the “name” and “telephone” elements from the XML file. The data in the “website” could be used to convert the “name” into a clickable link.

As regards the appearance of the data in the resulting HTML output, this would be controlled by a linked CSS file. CSS can be used to format the output in any way we desire, so our bulleted list can take on pretty much any appearance we care to give it.

You can get up to date information on PHP AJAX training courses, visit Macresource Computer Training, an independent computer training company offering PHP AJAX Classes in London and throughout the UK.

Other articles you might like;

  • C-MAP NT+ ME-C201 - NE Africa Med Mid East Coast - Furuno FP-Card
  • Blue Sea 4005 Standard Cable Caps
  • C-MAP NT+ ME-C202 - Red Sea-Arabian Sea - Furuno FP-Card
  • C-MAP NT+ NA-C039 - Ohio River Cairo Pittsburgh - Furuno FP-Card
  • Blue Sea 3000 HD-Series Battery Switch Single Circuit ON/OFF

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

Filed under: Software by Jake Smith Tagged with: Computer Software • computers • extensible markup language • HTML • pdf • sgml • Software • software programs • training • tutorial • web development • xml

Comments are closed.

« Smallville Season 10 Finally Achieved Tips On Avoiding Your Taskbar From Disappearing »
    Related Articles
    • C-MAP NT+ ME-C201 - NE Africa Med Mid East Coast - Furuno FP-Card
    • Blue Sea 4005 Standard Cable Caps
    • C-MAP NT+ ME-C202 - Red Sea-Arabian Sea - Furuno FP-Card
    • C-MAP NT+ NA-C039 - Ohio River Cairo Pittsburgh - Furuno FP-Card
    • Blue Sea 3000 HD-Series Battery Switch Single Circuit ON/OFF
    Recent Posts
    • Friends With Beads: Friendship Bead Bracelets Holding Teens Together
    • Use These Easy Self Improvement Techniques For Greater Living
    • Why A Self Tanner Is A Superior Selection
    • Various Tanning Ideas To Get A Great Tan
    • How Airbrush Tanning Products Are An Important Element To The Process
    All Categories
    • Beauty (430)
    • Boating (21)
    • Business (2919)
    • Cleaning Tips and Tools (131)
    • Current Events (5)
    • Ecommerce (152)
    • Email Marketing (17)
    • Fishing (36)
    • Home Based Business (648)
    • Home Improvement (395)
    • Industrial Mechanical (432)
    • Internet Marketing (57)
    • Marketing (1569)
    • Marriage (322)
    • Site Promotion (180)
    • Small Business (158)
    • Software (262)
    • Travel Tips (51)
    • Women's Interest (152)
    Pages
    • About
    • Contact
    • Privacy Policy
    • Terms of Service

© 2009 “Sea Side Scrap Book” · Some Rights Reserved.