ASP Error: 70
Description: Permission denied
Source: Microsoft VBScript runtime error
|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Merge two XML files
I have 2 XML files that I want to be able to merge them together given a
list of keys. I have searched the group but the examples are slightly
different than ours. Our XML files have the following format:
XML1.xml <Document> <row> <column name="FirstName">Smith</column> <column name="LastName">John</column> <column name="Address">7777 First </column> </row> <row> <column name="FirstName">Smith2</column> <column name="LastName">John2</column> <column name="Address">7777 Second </column> </row> ... </Document> XML2.xml <Document> <row> <column name="FirstName">Smith</column> <column name="LastName">John</column> <column name="Age">36</column> </row> <row> <column name="FirstName">Smith2</column> <column name="LastName">John2</column> <column name="Age">40</column> </row> ... </Document> The result XML should be: <Document> <row> <column name="FirstName">Smith</column> <column name="LastName">John</column> <column name="Address">7777 First </column> <column name="Age">36</column> </row> <row> <column name="FirstName">Smith2</column> <column name="LastName">John2</column> <column name="Address">7777 Second </column> <column name="Age">40</column> </row> ... </Document> Here is my first attempt of writing the XSL file. For simplification, I just tried to merge them based on the "FirstName" column. However, I don't know how to specify the key to search in the second file.
<xsl:output method="xml" indent="yes"/> <xsl:param name="source" select="c:/temp/kmtable2.xml"/> <!--source of data--> <xsl:key name="row" match="$source/Document/row" use="column[@name='FirstName']"/> <xsl:template match="/"> <!--document element-->
<Document>
<xsl:for-each select="Document/row">
<xsl:copy-of select="."/>
<xsl:variable name="name" select="column[@name='FirstName']"/>
<xsl:for-each select="document($source)/Document/row">
<xsl:apply-templates select="key('row', $name)"/>
</xsl:for-each> -->
</xsl:for-each>
</Document>
</xsl:template><xsl:template match="row"> <xsl:copy-of select="."/> </xsl:template> </xsl:stylesheet> It kept complaining about "A node test that matches either NCName:* or QName was expected.". It looks like it doesn't like the match claus in <xsl:key>. _________________________________________________________________ Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail 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
|

Cart








