[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Selecting the value from diff i/p XML
You key function returns the elements of Root2.xml whose id matches
those of the Root1 items.
But ultimately you want to lookup the value attributes of the corresponding Root1 elements. If you really want to process root2.xml as primary source, you may try this (XPath2's 3-argument key function involved): <xsl:key name="idlist" match="data|item" use="@id"/> <xsl:variable name="data" select="document('Root1.xml')"/> <xsl:template match="/"> <xsl:for-each select="key( 'idlist', key('idlist', $data/root1/item/@id)/@id, $data ) "> <xsl:value-of select="@value"/> <br/> </xsl:for-each> </xsl:template> But I think processing root1.xml is easier: <xsl:key name="idlist" match="item" use="@id"/> <xsl:variable name="data" select="document('Root2.xml')"/> <xsl:template match="/"> <xsl:for-each select="key('idlist', $data/root2/data/@id)"> <xsl:value-of select="@value"/> <br/> </xsl:for-each> </xsl:template> -Gerrit On 15.09.2010 23:21, Shashank Jain wrote:
Registergericht / Commercial Register: Amtsgericht Leipzig Registernummer / Registration Number: HRB 24930 Geschdftsf|hrer: Gerrit Imsieke, Svea Jelonek, Thomas Schmidt, Dr. Reinhard Vvckler ---------------------------------------------------------------------- Besuchen Sie uns auf der Frankfurter Buchmesse in Halle 4.2, Stand G446. Mehr dazu unter www.le-tex.de/de/buchmesse.html
|
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
|