[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Merging the attributes of a similar element
----- 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
|
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
|