Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

merging two xml doc using xml

1 view
Skip to first unread message

hItChHiKeR

unread,
Jun 17, 2004, 8:13:34 AM6/17/04
to
i have 2 xml files

xml1.xml
------
<case>
<row name="p1" />
<row name="p2" />
<row name="p3" />
</case>
-----

xml2.xml
-----
<case>
<row val="v1" />
<row val="v2" />
<row val="v3" />
</case>
-----

now i have to write a xsl which will read both document and will
generate a <table> like
<table>
<tr>
<td>name</td>
<td>val</td>
</tr>
</table>
can anyone help me out on this...!?
the one i was tryin was like the followin
--
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head></head>
<body>
<xsl:variable name="doc1" select="document('xml1.xml')" />
<xsl:variable name="doc2" select="document('xml2.xml')" />
<table width="50%" border="1px">
<xsl:for-each select="$doc1//case//row">
<tr>
<td>
<xsl:value-of select="@name" />
</td><td>
<xsl:value-of select="$doc2//case//@val" />
</td>
</tr>
</xsl:for-each>

</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
--

TIA

0 new messages