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

How best to duplicate nodes??

Subject: How best to duplicate nodes??
From: "Hewko, Doug" <Doug.Hewko@xxxxxxxxxxxxxxx>
Date: Tue, 7 Aug 2001 15:39:18 -0400
jane dane
Can someone please help steer me in the right direction? I have an XML file
where people can be in one or more list (example below). I would like the
output to be grouped according to the team the person is one. Problem is
that I may now know what teams someone is in and I do not want to copy the
node in the XML file to have a one-to-one relationship for person to group.

I got the grouping to work. I am also to duplicate every node. The way I am
looking at doing this is to count the number of <group> entries. If it is
more than one, then I will duplicate the <member> node. Somehow, I will need
to ignore the first instance. Any recommendations?

Ideally, I would like to use a for-each command to create a new XML file
where each instance of <group> exists. Unfortunately, I do not know how to
set this up in Cocoon2 to have my desired output displayed.

************************** desired output ********************
  Team A
	Joe Blow
	Jane Dane
  Team B
	Joe Blow
	Jane Dane
	Jerry Berry
  Team C
	Jane Dane
************************ my XML file ************************
<teammembers>
	<member contact="yes">
	    <group>Team A</group>
	    <group>Team B</group>
		<name>
			<given_name>Joe</given_name>
			<last_name>Blow</last_name>
		</name>
	</member>
	<member>
	    <group>Team A</group>
	    <group>Team B</group>		
	    <group>Team C</group>
		<name>
			<given_name>Jane</given_name>
			<last_name>Dane</last_name>
		</name>
	</member>
	<member>
	    <group>Team B</group>		
		<name>
			<given_name>Jerry</given_name>
			<last_name>Berry</last_name>
		</name>
	</member>
**************(part of) my XSL file ****************************************
<xsl:template match="teammembers">
	<xsl:copy-of select="member" />
	<xsl:for-each select="member[count()"/>
  ..... from here I am grouping. Code removed for brevity.

 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.