This is a discussion on "iteration with xsl:for-each: newbie question?" within the Other Programming Languages section. This forum, and the thread "iteration with xsl:for-each: newbie question? are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
iteration with xsl:for-each: newbie question?
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
iteration with xsl:for-each: newbie question?
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> <roomsAprice>56</roomsAprice> <roomsBprice>59</roomsBprice> <roomsCprice>45</roomsCprice> <date>26/02/2006</date> </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:template match="/"> <Root> <xsl:for-each select="root/rooms/roomA/@date"> <rooms> <xsl:for-each select=".."> <roomsAprice> <xsl:value-of select="."/> </roomsAprice> <xsl:for-each select="../roomB/@date"> <roomsBprice> <xsl:value-of select=".."/> </roomsBprice> </xsl:for-each> <roomsCprice> <xsl:value-of select="../../roomC"/> </roomsCprice> <Date> <xsl:value-of select="."/> </Date> </xsl:for-each> </rooms> </xsl:for-each> </Root> </xsl:template> </xsl:stylesheet> Can someone help me on that? |
|
|
![]() |
| Tags |
| iteration, xslforeach, newbie, question |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| latest iteration of the .NET framework | welshstew | ASP.NET Forum | 1 | Dec 7th, 2007 20:56 |
| Newbie Question | DRWEB | Starting Out | 7 | Jun 20th, 2007 19:09 |
| XSL Newbie Question | mr4thjuly | Other Programming Languages | 0 | Oct 19th, 2006 17:37 |
| Newbie with a question | wishmastersjewelry | Web Page Design | 11 | Aug 21st, 2006 21:20 |
| PHP question (newbie) | btfans | PHP Forum | 7 | Dec 6th, 2005 02:53 |