Subject: AW: [xsl] WG: How to reorder an XML tree? From: "Griebel, Peer" <Peer.Griebel@xxxxxxxxx> Date: Fri, 22 Jun 2001 10:30:50 +0200 |
> Von: Paul Prescod [mailto:paulp@xxxxxxxxxxxxxxx] > > Perhaps you could be more explicit in the description of your problem. > Are you saying that the element with the id "b" should always > be moed to > be a child of the element with the id "d" and everything else should > remain the same? Should it be the first child, the last > child, the only > child? Sorry for not being precise. Yes "b" should always moved to "d", the rest should remain the same. For my problem it makes no difference for "b" being the first or the last child. In the meantime I came to a solution. I think it's quite complicated. Perhaps it should be possible to make it shorter. Especially the definition of the xsl:key is a problem. I didn't manage to get <xsl:template match="match="id('b')"> work. What am I doing wrong? Thank you for your help! <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" indent="no"/> <xsl:key name="object" match="*" use="@id"/> <xsl:template match="key('object','b')"> <xsl:comment> Object b stripped </xsl:comment> </xsl:template> <xsl:template match="key('object','b')" mode="copy"> <xsl:comment> Object b copied here </xsl:comment> <xsl:copy> <xsl:apply-templates select="*|@*|comment()|processing-instruction()|text()"/> </xsl:copy> </xsl:template> <xsl:template match="key('object','d')"> <xsl:copy> <xsl:apply-templates select="*|@*|comment()|processing-instruction()|text()"/> <xsl:apply-templates select="key('object','b')" mode="copy"/> </xsl:copy> </xsl:template> <xsl:template match="*|@*|comment()|processing-instruction()|text()"> <xsl:copy> <xsl:apply-templates select="*|@*|comment()|processing-instruction()|text()"/> </xsl:copy> </xsl:template> </xsl:stylesheet> connection reset by Peer -- Dr. Peer Griebel Tel: +49(0) 731 / 9 74 95-0 Dipl. Inform. Fax: +49(0) 731 / 9 74 95-20 Entire Software AG mailto:Peer.Griebel@xxxxxxxxx Pfarrer-Weiß-Weg 10 - 12 D-89077 Ulm http://www.entire.de XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Re: Re: Summing a Calculation, Dimitre Novatchev | Thread | [xsl] How to improve the performanc, Yang |
Re: [xsl] Inserting spaces in my FO, Rob Lugt | Date | Re: [xsl] conditional statements, David Carlisle |
Month |