[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

recursion and looping

Subject: recursion and looping
From: lachance@xxxxxxxxxxxxxxxxx (Francois Lachance)
Date: Thu, 23 Mar 2000 12:08:15 -0500 (EST)
recursion and looping
AIM - group elements according to attribute  value [indeterminate number
of values
Strategy - apply tempates subsequent subsets of nodeset
Problem - how to build the recursion without infinte  loop

Question: is the looping induced by the following stylesheet casued by a
failure to shift context node? If so how can one pass a param value that
cause a shift in context node? Or is this totally wrong-tree barking?

XSLT file

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
<xsl:output method="html"/>

<xsl:template match="/">

<xsl:template match="lg">
<xsl:call-template name="grouper" select="//w[@function='item']">
<xsl:with-param name="listname" select="'list1'"/>

<xsl:template name="grouper">

<xsl:param name="listname"/>

<xsl:param name="nodeset" select="//w[@n=$listname]"/>
<xsl:param name="nextset" select="//w[@n!=$listname]a"/>

<xsl:param name="nextlistname" select="$nextset/@n"/>

<xsl:if test="not($nextset='')"> 

<xsl:for-each select="$nodeset">
<xsl:sort select="." order="descending"/>
<xsl:value-of select="."/>

<xsl:call-template name="grouper">
<xsl:with-param name="listname" select="$nextlistname"/>




XML file

<l>The <w function="item" n="list1" group="primary">yellow</w> cab drove
<l>The <w function="item" n="list2" group="secondary">green</w> bus slides
to a stop.</l>
<l>The <w function="item" n="list1" group="primary">red</w> truck halted
<l>The <w function="item" n="list2" group="secondary">purple</w> van sped

Desired output: lists of items

yellow red
purple green 


Francois Lachance
Post-doctoral Fellow
projet HYPERLISTES project

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.