Subject: [xsl] Join XMLs with XLST with ralative data From: Mangesh Kakade <wadapaav@xxxxxxxxx> Date: Thu, 5 Jun 2003 01:34:08 -0700 (PDT) |
HI Everybody , I am very new to this list, As I was going thru the archive , I found the way to join the 2 or more XML docs using ?copy? and ?key? element. I used it in my program , but it seems not working well . I don?t know Where I went wrong . The two xml doc that I want to join are 22.xml <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="stock.xslt"?> <STKAVAILABLE> <STKMAST Alias="01" STKCODE="31> <STKCODE IndexID="5011"/> <STKDESC IndexID="5017"/> </STKMAST> <STKMAST Alias="01" STKCODE="30"> <STKCODE IndexID="5011"/> <STKDESC IndexID="5017"/> </STKMAST> <STKMAST Alias="01" STKCODE="32> <STKCODE IndexID="5011"/> <STKDESC IndexID="5017"/> </STKMAST> </STKAVAILABLE> buy22.xml <?xml version="1.0" encoding="UTF-8"?> <buyermaster> <name id="a001" deptid="01"> <address/> <bstkcode>31</bstkcode> </name> <name id="a010"> <address/> <bstkcode>31</bstkcode> </name> <name id="a003" deptid="10"> <address/> <bstkcode>40</bstkcode> <bstkcode>20</bstkcode> <bstkcode>35</bstkcode> </name> </buyermaster> I am using join.xslt <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:key name="rows-bstkcode" match="bstkcode" use="bstkcode" /> <xsl:variable name="x_22" select="document('22.xml')" /> <xsl:variable name="buy22" select="document('buy22.xml')" /> <xsl:template match="/"> <tran> <xsl:for-each select="$x_22/STKAVAILABLE/STKMAST"> <xsl:copy> <xsl:copy-of select="@*" /> <xsl:variable name="STKCODE" select="@STKCODE" /> <xsl:for-each select="$buy22"> <xsl:copy-of select="key('rows-bstkcode', $STKCODE) /*[name() != 'bstkcode']" /> </xsl:for-each> </xsl:copy> </xsl:for-each> </tran> </xsl:template> </xsl:stylesheet> And I want xml or HTML out put like this <tran> <STKMAST STKCODE="31" > <!?from 22.xml> <name id="a001"/> < !?Corresponding buyer id from buy22.xml--> <name id="a010"/> </STKMAST> </tran> but with my join.xslt I am getting following out put ( xml) <?xml version="1.0" encoding="UTF-8" ?> <tran> <STKMAST Alias="01" STKCODE="31" /> <STKMAST Alias="01" STKCODE="30" /> <STKMAST Alias="01" STKCODE="32" /> </tran> Pls Help me TIA Mangesh __________________________________ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] How to convert a numeric xs:g, thei | Thread | RE: [xsl] Join XMLs with XLST with , Jarno . Elovirta |
Re: [xsl] Could I set an attribute , Martin Grigorov | Date | RE: [xsl] Join XMLs with XLST with , Jarno . Elovirta |
Month |