[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Re: AW: recursion with xsl:apply-templates
Subject: Re: AW: recursion with xsl:apply-templates
From: Volker Witzel <volker.witzel@xxxxxxxxxxxx>
Date: Wed, 27 Aug 2003 16:53:52 +0200
|
Dear Juergen,
it is like David assumed:
> I'm not sure quite what transform you wanted, but i think it's just an
> identity transform plus copying the @index'th id element from the
> idlist??
So I can have mutliple occurances of the attribute index, but they need
to be transormed to a new id from the id_list.
Thanks,
Volker.
which would be
Zink, Juergen wrote:
Dear Volker,
instead of
<xsl:variable name="p" select="count(preceding::*[@index])+1"/>
do you mean this?
<xsl:variable name="p" select="@index"/>
<xsl:copy-of select="/transformation/id_list/id[$p]"/>
In your sample xml you have two rec... with the same value of @index.
Will they get the same id or not? Can you use the index?
Cheers,
Juergen
-----Ursprüngliche Nachricht-----
Von: Volker Witzel [mailto:volker.witzel@xxxxxxxxxxxx]
Gesendet am: Mittwoch, 27. August 2003 15:10
An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Betreff: Re: recursion with xsl:apply-templates
Dear David, Mike, Andrew,
thanks very much for help and quick responses. Seems that I stuck on my
recursion too much. Based on your input I'm now using the follwing code,
which works as expected:
<xsl:template match="/transformation">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="*[@index]">
<xsl:copy>
<xsl:copy-of select="@*[not(name()='index')]"/>
<xsl:variable name="p" select="count(preceding::*[@index])+1"/>
<xsl:copy-of select="/transformation/id_list/id[$p]"/>
<xsl:copy-of select="child::node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="id_list"/>
Davis: next time I'll provide a better input!
Volker.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
*****************************************************************************
Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte
Informationen. Wenn Sie nicht der richtige Adressat sind oder diese
eMail irrtuemlich erhalten haben, informieren Sie bitte sofort den
Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren
sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.
This e-mail may contain confidential and/or privileged information.
If you are not the intended recipient (or have received this e-mail
in error) please notify the sender immediately and destroy this e-mail.
Any unauthorized copying, disclosure or distribution of the material
in this e-mail is strictly forbidden.
*****************************************************************************
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
--
Mit freundlichen Grüßen / With kind regards
Volker Witzel
____________________________________________
IBM Business Consulting Services
Karl-Arnold-Platz 1a, D-40474 Düsseldorf
fon (0211) 476-1924 (intern *129-1924)
mobil 0172-73 66 586
mail vwitzel@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
RSS 2.0 |
|
Atom 0.3 |
|
|