I got this to work, the declartion of the key had to be outside any template
node
<xsl:key name="k1" match="Metrics/*" use="local-name()"/>
Thanks Martin, this has solved my problem.
regards
Rajesh
----- Original Message ----
From: Martin Honnen <Martin(_dot_)Honnen(_at_)gmx(_dot_)de>
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Sent: Monday, September 28, 2009 11:31:56 AM
Subject: Re: [xsl] Help XSL Transformation of Data
Rajesh Jain wrote:
I am using the code snippet you provided, along with the row to output the
time. But this doesn't seem to work. The only thing I changed was to remove
the template definition and added Chart-Data before Root.
I get an error XML Parsing Error: no element found
I am complete newbie, so please let me know if I have to use template
definition and how to use it.
We need to see the complete code of the stylesheet you use, if the XML parsing
error occurs in that stylesheet.
If the code below is your complete stylesheet then you have certainly removed
essential elements like the xsl:stylesheet element and of course also the
xsl:template.
<xsl:key name="k1" match="Metrics/*" use="local-name()"/>
<chart_data>
<!-- Category (X axis) date row -->
<row>
<null/>
<xsl:for-each select="Chart-Data/Root/Item[position()=1]/Statistics/Item">
<string><xsl:value-of select="@StartRawDateAndTime"/></string>
</xsl:for-each>
</row>
<xsl:for-each
select="Chart-Data/Root/Item/Statistics/Item[1]/Metrics/*">
<row>
<string><xsl:value-of select="local-name()"/></string>
<xsl:for-each select="key('k1', local-name())">
<number><xsl:value-of select="number(@TotalValue)"/></number>
</xsl:for-each>
</row>
</xsl:for-each>
</chart_data>
--
Martin Honnen
http://msmvps.com/blogs/martin_honnen/
--~------------------------------------------------------------------
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>
--~--
--~------------------------------------------------------------------
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>
--~--