Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries [Thread Prev] >Thread Next - Re: triple xsl:for-each problem? Please any suggestion triple xsl:for-each problem? Please any suggestionTo: NULL Date: 7/7/2006 6:07:00 AM Hello, I have a xml file with this structure <root> <rooms> <roomsA price="56"/> <date>26/02/2006</date> <roomsA> <roomA price="65"/> <date>26/03/2006</date> </roomsA> <roomB price="59"> <date>26/02/2006</date> </roomB> <roomB price="75"> <date>26/03/2006</date> </roomB> <roomC price="45"> <date>26/02/2006</date> </roomC> <roomC price="75"> <date>26/03/2006</date> </roomC> </rooms> </root> and I would like to obtain something like this <Room> <date>26/02/2006</date> <roomsAprice>56</roomsAprice> <roomsBprice>59</roomsBprice> <roomsCprice>45</roomsCprice> </Room> <Room> <roomsAprice>65</roomsAprice> <roomsBprice>75</roomsBprice> <roomsCprice>75</roomsCprice> <Date>26/03/2006</Date> </Room> I tried to do xsl:each-for and doesn't work very well. <?xml version='1.0' ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:for-each select="root/rooms"> <Root> <xsl:for-each select="roomC"> <xsl:for-each select="../roomB"> <xsl:for-each select="../roomA"> <rooms> <roomsAprice> <xsl:value-of select="."/> </roomsAprice> <roomsBprice> <xsl:value-of select="../roomB"/> </roomsBprice> <roomsCprice> <xsl:value-of select="../roomC"/> </roomsCprice> <Date> <xsl:value-of select="@date"/> </Date> </rooms> </xsl:for-each> </xsl:for-each> </xsl:for-each> </Root> </xsl:for-each> </xsl:template> </xsl:stylesheet> Can someone help me on that? Ina | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
