Is the XML you have shown fixed or are you allowed to change the xml ?
because, by the look of it, it doesnt look like it is properly designed..
for instance, your xml could be ..
<?xml version="1.0" encoding="UTF-8" standalone ="yes"?>
<A>
<B>
<Data id = "1">Data11</Data>
</B>
<C>
<Data id = "2">Data21</Data>
</C>
<D>
<Data id = "3">Data31</Data>
</D>
<B>
<Data id = "1">Data12</Data>
</B>
<C>
<Data id = "2">Data22</Data>
</C>
<D>
<Data id = "3">Data32</Data>
</D>
</A>
You normally dont want to keep separate nodes just to differentiate the
types of logically same node.
With the above structure,
you can do
<xsl:template match = "A">
<xsl:apply-templates select = "//Data"/>
</xsl:template>
<xsl:template match = "Data">
<xsl:value-of select = "."/>
<br/>
</xsl:template>
if you still want to continue with your XML , this will work.
<xsl:template match="A">
<xsl:apply-templates select="*"/>
</xsl:template>
<xsl:template match="*">
<xsl:value-of select = "."/>
<br/>
</xsl:template>
But as I said, It is best to restructure your XML as Above.
HTH
Vasu
From: "rajasekhar v" <bigfundu(_at_)hotmail(_dot_)com>
Reply-To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Handling Repeating XML !!
Date: Mon, 23 Aug 2004 16:34:15 +0530
All,
I have the following XML,
<?xml version="1.0" encoding="UTF-8" standalone ="yes"?>
<A>
<B>
<Data1>Data11</Data1>
</B>
<C>
<Data2>Data21</Data2>
</C>
<D>
<Data3>Data31</Data3>
</D>
<B>
<Data1>Data12</Data1>
</B>
<C>
<Data2>Data22</Data2>
</C>
<D>
<Data3>Data32</Data3>
</D>
</A>
Basically, the sets of B,C,D keep repeating inside the common root tag A.
And I want it to be displayed as the following in HTML:
Data11
Data21
Data31
Data12
Data22
Data32
Am not able to find any XSL example that would help me to do the same.
Please help me out if any of you already have such an example worked out or
know the trick to do it, since this is very important for me now.
Thanks and Regards,
Raj
_________________________________________________________________
Claim your Citibank Ready Cash today. http://go.msnserver.com/IN/54177.asp
It?s fast, easy and affordable.
--+------------------------------------------------------------------
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>
--+--
_________________________________________________________________
Stay in touch with absent friends - get MSN Messenger
http://www.msn.co.uk/messenger