Subject: Re: [xsl] Merging the attributes of a similar element From: "James Fuller" <james.fuller@xxxxxxxxxx> Date: Fri, 5 Jul 2002 11:41:41 +0100 |
----- 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Merging the attributes of a s, Kalyan Kumar Mudumba | Thread | [xsl] Keep-together and friends, Antonio Fiol |
Re: [xsl] fo:inline vs. fo:wrapper, David Tolpin | Date | RE: [xsl] The Future of Browser-Bou, DPawson |
Month |