xsl-list
[Top] [All Lists]

RE: possible nested loops

2006-02-14 16:09:14
i think this is quite straight forward if i understood your question correctly.
lets assume you have an xml,
<country>
<state>
  <city/>
  <city>
</state>
<state>
  <city/>
  <city>
</state>
<state>
  <city/>
  <city>
</state>
</country>

a stylesheet
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
        <xsl:template match="country">
                <!--process country nodes-->
                <xsl:apply-templates/>
        </xsl:template>
        <xsl:template match="state">
                <!--process state nodes-->
                <xsl:apply-templates/>
        </xsl:template>
        <xsl:template match="city">
                <!--process city nodes-->
                <xsl:apply-templates/>
        </xsl:template>
</xsl:stylesheet>


will basically match templates to all levels.

I mean,if this is what you need,I reckon you must have missed reading the initial chapters of any standard xslt book.

vasu

From: garry(_at_)skegnessgrammar(_dot_)org
Reply-To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] possible nested loops
Date: Tue, 14 Feb 2006 22:20:57 -0000 (GMT)

I wonder if someone could point me in the right direction to solve my
problem. I need to transform an xml file to html. I have tried to make a
stylesheet but none of my efforts have been successful.
The xml has around 800 pupil records (<pupil>) so I want to iterate over
each pupil node. Within each pupil node there are other nodes which
repeat, so for each pupil I need to iterate over child nodes of which
there may be none or many of each type. I suspect a nested loop of some
sort may help but I have not been able to implement one, any ideas?
regards
garry


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


_________________________________________________________________
Are you using the latest version of MSN Messenger? Download MSN Messenger 7.5 today! http://messenger.msn.co.uk


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>