[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Merging common tags of 2 xml files
varun bhatnagar varun292006@xxxxxxxxx wrote:
*_File1.xml_* I think you simply need to write a template for the root that pulls in the nodes from the other document and then your template for "version" simply needs to add the attributes: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:param name="doc2-url" select="'file2.xml'"/> <xsl:variable name="doc2" select="document($doc2-url)"/> <xsl:output method="xml" indent="yes"/> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()" /> </xsl:copy> </xsl:template> <xsl:template match="/*"> <xsl:copy> <xsl:apply-templates select="@* , $doc2/*/node(), node()"/> </xsl:copy> </xsl:template> <xsl:template match="version"> <xsl:copy> <xsl:attribute name="Level"> <xsl:value-of select="'test'"></xsl:value-of> </xsl:attribute> <xsl:attribute name="sNo"> <xsl:value-of select="'test'"></xsl:value-of> </xsl:attribute> <xsl:apply-templates select="@* | node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet>
|
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
|