[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?

Subject: How to re-parse information to a different purpose with XSL?
From: zze-minitel2001 balr002 <minitel2001.balr002@xxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 2 Jun 1999 18:28:15 +0200
parse information
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.