RE: Selecting the value from diff i/p XML
Thanks Gerrit, Hermann, Bauman and Mukul for helping me out. The 3 argument Key function is really cool, but for some reason I am not getting any output with that. I am trying to run that in the latest version of XML Spy and also tried using Saxon9he processor. I was able to get the desired output using Bauman's solution. I tweaked the code little bit and put an if condition so that it gives me the values of the ID's which are matched. <xsl:template match="/"> <wrapper> <xsl:apply-templates select="root2/data"/> </wrapper> </xsl:template> <xsl:template match="data"> <out> <xsl:if test="$data/root1/item[@id=current()/@id]"> <xsl:value-of select="@id"/> <xsl:text>=</xsl:text> <xsl:value-of select="$data/root1/item[@id=current()/@id]/@value"/> <br/> </xsl:if> </out> </xsl:template Mukul, I think you missed that I want to apply my XSLT on Root2.xml. but thanks for your help :-) Thanks again, Shashank Jain ---------------------------------------- > From: gandhi.mukul@xxxxxxxxx > Date: Thu, 16 Sep 2010 09:08:01 +0530 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: Re: Selecting the value from diff i/p XML > > On Thu, Sep 16, 2010 at 6:14 AM, Mukul Gandhi wrote: > > 2.0 > > > > > here the loop is linear too (i.e a linear traversal from user > perspective -- though in memory real traversal algorithm could be XSLT > processor specific), but the value lookup by 'key' here is indexed by > the XSLT processor (the internals of this is again processor > specific), which usually performs faster for large data sets. > > > > -- > Regards, > Mukul Gandhi
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