Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


xsl:for-each-group error...

From: hzgt9b <celoftis@-----.--->
To: NULL
Date: 9/11/2007 9:04:00 AM

I am a bit of a newbie to XSLT and am feeling my way around. Here is a
sample I found on the internet that I am trying to replicate on my
machine but am having problems. Specifically, the "<xsl:for-each-
group" element gets an error: "Keyword xsl:template may not contain
xsl:for-each-group ". I can find documentation for this element, so
I'm a bit lost as to the source of the problem. Anyone have any ideas.
See my XML ans XSL files below:

Thanks in advance,
celoftis

XML: (saved as test.xml)
----------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="test.xsl"?>
<cities>
<city name="Williamsburg" state="Virginia" pop="11998" />
<city name="New York City" state="New York" pop="80000" />
<city name="Washington" state="DC" pop="553523" />
<city name="Richmond" state="Virginia" pop="300000" />
</cities>


XSL: (saved as test.xsl)
----------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
<xsl:template match="/">
<table>
<xsl:for-each-group select="cities/city" group-by="@state"> <!--I can
see error on this line (I can't copy the tooltip contant, but it's
something like,'for-each-group' is invalid child element for template,
etc.....) -->
<tr>
<td><xsl:value-of select="@state" /></td>
<td>
<xsl:value-of select="current-group()/@name" separator=", " />
</td>
<td><xsl:value-of select="sum(current-group()/@pop)" /></td>
</tr>
</xsl:for-each-group>
</table>
</xsl:template>
</xsl:stylesheet>



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent