[Home] [By Thread] [By Date] [Recent Entries]
On 16.09.2010 16:20, Shashank Jain wrote:
Maybe you specified version="1.0" instead of 2.0 in the xsl:stylesheet element, or you didn't use the modified xsl:key declaration (indexing both item and data elements)? Mukul, I think you missed that I want to apply my XSLT on Root2.xml. but thanks for your help :-) If you really need to process root2.xml and need keys for performance, you may like this one: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" > <xsl:output
method="xml"
indent="yes"
/> <xsl:key
name="idlist"
match="item"
use="@id"
/>
<xsl:variable
name="data"
select="document('Root1.xml')"
as="document-node(element(root1))"
/> <!-- processing Root2.xml: -->
<xsl:template match="/">
<xsl:apply-templates
select="$data/root1"
mode="lookup-r1-values">
<xsl:with-param name="root2" select="root2" />
</xsl:apply-templates>
</xsl:template> <xsl:template match="root1" mode="lookup-r1-values">
<xsl:param name="root2" as="element(root2)" />
<xsl:for-each select="key('idlist', $root2/data/@id)">
<xsl:value-of select="@value"/>
<br/>
</xsl:for-each>
</xsl:template></xsl:stylesheet> -Gerrit
|

Cart



