Re: [xsl] Help XSL Transformation of Data

Subject: Re: [xsl] Help XSL Transformation of Data
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Mon, 28 Sep 2009 19:32:00 +0200
Rajesh Jain wrote:

<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

Is there any reason that you have version="1.1"?


<!-- ================================================================== -->
<!-- ==== G L O B A L   P A R A M E T E R S =========================== -->
<!-- ================================================================== -->

<xsl:param name="skin.images" />
<xsl:param name="webapp" />


<!-- ================================================================== --> <!-- ==== TEMPLATE: chart-data-xml ==================================== --> <!-- ================================================================== --> <xsl:template name="chart-data-xml">


<xsl:variable name="color"> <xsl:choose> <xsl:when test="/page/HttpRequest/Parameters/@Color!=''"><xsl:value-of select="/page/HttpRequest/Parameters/@Color"/></xsl:when> <xsl:otherwise>5555ff</xsl:otherwise> </xsl:choose> </xsl:variable>

  <xsl:variable name="skip" select="count(Chart-Data/Root/Item[position()=1]/Statistics/Item) div 4"/>
  <xsl:variable name="chartids">
    <xsl:for-each select="Chart-Data/Root/Item">
      <xsl:value-of select="@ID"/><xsl:text>,</xsl:text>
    </xsl:for-each>
  </xsl:variable>



  <!-- ================================================================== -->
  <!-- Chart Data ======================================================= -->
  <!-- ================================================================== -->
    <xsl:output indent="yes"/>

xsl:output has to be a top level element (child of xsl:stylesheet).


<xsl:apply-templates select="Chart-Data"/>

<xsl:key name="k1" match="Metrics/*" use="local-name()"/>

xsl:key has to be a top level element as well.



<xsl:template match="Chart-Data">

You can't nest templates so you need to move this xsl:template out of the outer xsl:template.





--


	Martin Honnen
	http://msmvps.com/blogs/martin_honnen/

Current Thread