i trying achieve more flexible groub-by statement xslt, using variable (depending of variable value, there different grouping needed):
....... <xsl:param name="rows"/> <xsl:variable name="groupby"> <xsl:choose> <xsl:when test="$report_type='first_type'"> <xsl:value-of select="concat(date,ccy)"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="concat(type,ccy)"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:for-each-group select="$rows" group-by="$groupby"> ..... </xsl:for-each-group>
as far know kind of construction won't work (well, didn't work me).
my question is: how pass variable group-by attribute?
thank in advance kind of help.
the problem here not "how pass variable group-by attribute", content of passed variable. group-by
attribute must contain xpath expression - passing string value.
if there 2 ways group nodes, suggest use following construct:
<xsl:for-each-group select="item" group-by="if($report_type='first_type') concat(date,ccy) else concat(type,ccy)">
Comments
Post a Comment