|
Subject: Re: [xsl] Selecting the value from diff i/p XML From: "Imsieke, Gerrit, le-tex" <gerrit.imsieke@xxxxxxxxx> Date: Thu, 16 Sep 2010 21:37:22 +0200 |
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.
Mukul, I think you missed that I want to apply my XSLT on Root2.xml. but thanks for your help :-)
<?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>| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] Selecting the value from , Shashank Jain | Thread | RE: [xsl] Selecting the value from , Shashank Jain |
| Re: [xsl] [ann] oXygen version 12 -, Lars Huttar | Date | Re: [xsl] Preceding siblings test, Hermann Stamm-Wilbra |
| Month |