xsl-list
[Top] [All Lists]

RE: [xsl] Selecting the value from diff i/p XML

2010-09-16 09:20:40

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[(_at_)id=current()/@id]">
    <xsl:value-of select="@id"/>
    <xsl:text>=</xsl:text>
    <xsl:value-of select="$data/root1/item[(_at_)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(_dot_)mukul(_at_)gmail(_dot_)com
Date: Thu, 16 Sep 2010 09:08:01 +0530
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] 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

--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
--~--

                                          
--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--