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

Re: Merging the attributes of a similar element

Subject: Re: Merging the attributes of a similar element
From: "James Fuller" <james.fuller@xxxxxxxxxx>
Date: Fri, 5 Jul 2002 11:41:41 +0100
xsl merging same elements together
----- Original Message -----
From: "Kalyan Kumar Mudumbai" <kalyan_tech@xxxxxxxxxxxxxx>
>       I am merging two XML files which are almost similar in
> structure. While merging, suppose if I have an element with one
> attribute like


> <Name first_name="Kalyan" last_name="Kumar"/> in one XML file and
> the same element
> <Name middle_name="Kallu"/> in the second XML. Now after merging
> the two files, is it POSSIBLE for me to have the element look like
> this

<Name first_name="Kalyan" last_name="Kumar" middle_name="Kallu"/>
 (where the attributes are merged).


something like this

xsl file
-------------------------------------------------
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:template match="data">
 <name>
 <xsl:for-each select = "name/@*">
                <xsl:copy />
 </xsl:for-each>
 </name>

 <name>
 <xsl:apply-templates select="/name"/>
 </name>

 </xsl:template>

 <xsl:template match="name">
 <xsl:copy-of select="@*"/>
 </xsl:template>

</xsl:stylesheet>

xml file
-------------------------------------------------
<?xml version="1.0" ?>
<data>
<name first="James"/>
<name last="Fuller"/>
</data>


basically i show 2 variations of merging attributes

take a look here for more info
http://www.dpawson.co.uk/xsl/sect2/N1553.html#d84e66


regards, jim fuller




 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.