[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] How best to duplicate nodes??
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
|
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
|