[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: flatten XML tree

Subject: RE: flatten XML tree
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Mon, 18 Mar 2002 17:09:51 -0000
flatten xml
<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:  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

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.