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

Subject: RE: [xsl] Selecting the value from diff i/p XML
From: Shashank Jain <shashankjain@xxxxxxxx>
Date: Thu, 16 Sep 2010 09:20:25 -0500
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: [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

Current Thread