|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] How to re-parse information to a different purpose with XSL?
I'm novice in XSL and I have the following problem when converting data described in xml to generated HTML. ? <data> ??? <listItem1> ??????? <item1> ??????????? <name>toto</name> ??????????? <id>001</id>??????????? ??????? <item1> ??????? <item1> ??????????? <name>titi</name> ??????????? <id>002</id>??????????? ??????? <item1> ??? </listItem1> ??? <listItem2> ??????? <item2>...</item2> ??? </listItem2> </data>??? ? In my page, I want, first to display the names listItem1, then display listItem2, then display again info on item1 (to put buttons for example). The only solution I've found is this one but it's not very convenient for me and I would like to know if there is another one: ? ?<!-- Root xsl:template - start processing here --> ?<xsl:template match="/"> ??? <!-- Here we build the table of item1 and the item2 info --> ??? <xsl:apply-templates select="/data/*"/> ??? <!-- Then I want to parse all item1 again, but with another rule! --> ??? <xsl:apply-templates select="//listItem1/item1/*"/> ?</xsl:template> <!-- For the first pass --> <xsl:template match="listItem1"> ??? <TABLE border="double"> ??? <xsl:apply-templates select="item1" /> ??? </TABLE> </xsl:template> ? <xsl:template match="item1"> ??? <TD><xsl:value-of select="name"/></TD> </xsl:template> ? <xsl:template match="listItem2"> ??? <b>Item2</b> </xsl:template> ? <!-- Rules for the second pass --> <xsl:template match="item1/id"> ??? <INPUT type="submit" > ??????? <xsl:attribute name="name"><xsl:value-of select="from-self"/></xsl:attribute> ??????? <xsl:attribute name="value"><xsl:value-of select="../name"/></xsl:attribute> ??? </INPUT> </xsl:template> ? <!-- Rule to avoid dislpaying the name during the second pass --> <xsl:template match="name"> </xsl:template> ? Thanks. ---------------------------------------------------------------------------- -------- Simon Bécot Ingénieur développement Softeam - http://www.softeam.fr <http://www.softeam.fr/> - - CNET Rennes - mailto:simon.becot@xxxxxxxxxx <mailto:simon.becot@xxxxxxxxxx> ---------------------------------------------------------------------------- -------- ? XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








