<xsl:for-each select="//*[local-name()='ResultCategoryNode']">
<graph3>
<xsl:attribute name="Name">
<xsl:value-of select="@ResultFieldCategory"/>
</xsl:attribute>
<xsl:for-each select="(//*[local-name()='ResultCategoryNode'])[@ResultFieldCategory=??ValuesFromOuterLoop??]">
<graph>
<xsl:attribute name="name">
<xsl:value-of select="@ReportFieldMonth"/>
</xsl:attribute>
<xsl:attribute name="value">
<xsl:value-of select="@ReportFieldValue"/>
</xsl:attribute>
</graph>
</xsl:for-each>
which is incomplete and not working .<graph1 Name="Waste">
<graph name="Jun 2010" value="8" />
<graph name="July 2010" value="4" />
<graph name="Aug 2010" value="0" />
<graph name="Sep 2010" value="0" />
<graph name="Oct 2010" value="0" />
<graph name="Nov 2010" value="8" />
</graph1>
<graph2 Name="Water">
<graph name="Jun 2010" value="34" />
<graph name="July 2010" value="40" />
<graph name="Aug 2010" value="1" />
<graph name="Sep 2010" value="2" />
<graph name="Oct 2010" value="38" />
<graph name="Nov 2010" value="4" />
</graph2>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates select="//*[local-name()='ResultCategoryNode']"/>
</xsl:template>
<xsl:template match="*[local-name()='ResultCategoryNode']">
<xsl:element name="{concat('graph', position())}">
<xsl:attribute name="Name">
<xsl:value-of select="@ResultCategoryFieldCategory"/>
</xsl:attribute>
<xsl:apply-templates select=".//*[local-name()='ResultDetailsNode']">
</xsl:apply-templates>
</xsl:element>
</xsl:template>
<xsl:template match="*[local-name()='ResultDetailsNode']">
<graph>
<xsl:attribute name="name">
<xsl:value-of select="@ResultFieldMonth"/>
</xsl:attribute>
<xsl:attribute name="value">
<xsl:value-of select="@ResultFieldNoOfJobs"/>
</xsl:attribute>
</graph>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:lgw="LineGraphWidget"
exclude-result-prefixes="lgw"
version="1.0">
<xsl:output indent="yes"/>
<xsl:template match="/">
<xsl:element name="graphs">
<xsl:apply-templates select="//lgw:ResultCategoryNode"/>
</xsl:element>
</xsl:template>
<xsl:template match="lgw:ResultCategoryNode">
<xsl:element name="{concat('graph', format-number(position(), '000'))}">
<xsl:attribute name="Name">
<xsl:value-of select="@ResultCategoryFieldCategory"/>
</xsl:attribute>
<xsl:apply-templates select=".//lgw:ResultDetailsNode">
</xsl:apply-templates>
</xsl:element>
</xsl:template>
<xsl:template match="lgw:ResultDetailsNode">
<xsl:element name="graph">
<xsl:attribute name="name">
<xsl:value-of select="@ResultFieldMonth"/>
</xsl:attribute>
<xsl:attribute name="value">
<xsl:value-of select="@ResultFieldNoOfJobs"/>
</xsl:attribute>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:lgw="LineGraphWidget"
exclude-result-prefixes="lgw"
version="1.0">
<xsl:output indent="yes"/>
<xsl:template match="/">
<xsl:element name="graphs">
<xsl:element name="graphconfig">
<xsl:attribute name="colorSet">
<xsl:value-of select="'mixColors'"/>
</xsl:attribute>
<xsl:attribute name="minVal">
<xsl:value-of select="0"/>
</xsl:attribute>
<xsl:attribute name="maxVal">
<xsl:value-of select="100"/>
</xsl:attribute>
<xsl:attribute name="inte">
<xsl:value-of select="50"/>
</xsl:attribute>
<xsl:apply-templates select="//lgw:Details1"/>
</xsl:element>
<xsl:element name="graphholder">
<xsl:apply-templates select="//lgw:ResultCategoryNode"/>
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template match="lgw:Details1">
<xsl:element name="graph">
<xsl:attribute name="name">
<xsl:value-of select="@ConfigMonth"/>
</xsl:attribute>
</xsl:element>
</xsl:template>
<xsl:template match="lgw:ResultCategoryNode">
<xsl:element name="{concat('graph', position())}">
<xsl:attribute name="Name">
<xsl:value-of select="@ResultCategoryFieldCategory"/>
</xsl:attribute>
<xsl:apply-templates select=".//lgw:ResultDetailsNode">
</xsl:apply-templates>
</xsl:element>
</xsl:template>
<xsl:template match="lgw:ResultDetailsNode">
<xsl:element name="graph">
<xsl:attribute name="value">
<xsl:value-of select="@ResultFieldNoOfJobs"/>
</xsl:attribute>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
After 6.5h of struggle and just before getting your solution I managed to do that by cheating..... I duplicated my field so I have it on higher and lower level and used the attached code (after stealing your contactenation as I struggled with that as well)
Many thanks for your code. Once I have it I will practise with it and probably replace my existing one to avoid workarounds.
Regards
Emil
Open in new window