Subject: RE: [xsl] flatten XML tree From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx> Date: Mon, 18 Mar 2002 17:09:51 -0000 |
<xsl:for-each select="//article"> <xsl:copy-of select="*"/> <xsl:copy-of select="ancestor::issue/number"/> <xsl:copy-of select="ancestor::issue/topic"> </xsl:for-each> Michael Kay Software AG home: Michael.H.Kay@xxxxxxxxxxxx work: Michael.Kay@xxxxxxxxxxxxxx > -----Original Message----- > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Robert > Sösemann > Sent: 18 March 2002 16:20 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: [xsl] flatten XML tree > > > Hello, > > how can I flatten my XML like that? > > This is the source: > > <archive> > <issue> > <number>2</number> > <topic>Genetic Diseases</topic> > <articles> > <article> > <title>The magic of DNA</title> > <author>Ronald Mueller</author> > <keywords>genetics,dna</keywords> > </article> > <article> > <title> DNA demystified</title> > <author>Arnold Breed</author> > <keywords>genetics,dna</keywords> > </article> > *many articles* > </articles> > </issue> > *many magazines* > </archive> > > and I want: > > <archive> > <article> > <number>2</number> > <topic>Genetic Diseases</topic> > <title>The magic of DNA</title> > <author>Ronald Mueller</author> > <keywords>genetics,dna</keywords> > </article> > <article> > <number>2</number> > <topic>Genetic Diseases</topic> > <title> DNA demystified</title> > <author>Arnold Breed</author> > <keywords>genetics,dna</keywords> > </article> > *many articles* > </archive> > > All that I want to define is that I only want the root and an > amount of > article nodes. > The children of article can stay as they are. > All ancestors like number and topic that semantically belong > also to an > article schould became direct childs of article. > > Would that be possible? And could this even be undone? > > Thanks in advance. > > Rob > .............................................................. > .............. > .......... > ROBERT SÖSEMANN (robert.soesemann@xxxxxx) > > schwärzlocherstr. 29/1 | 72070 tübingen > tel : 07071 / 400 880 > > icq# : 100 467 870 > pgp-keys : www.webspace-journey.de/pgp.asc > .............................................................. > .............. > .......... > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] flatten XML tree, Robert Sösemann | Thread | [xsl] obtain src filename in the tr, 林 子芯 |
Re: [xsl] Variable group-by, David B. Bitton | Date | [xsl] Identity transformation (with, Roger L. Costello |
Month |