[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Dieter Schmerlaib wrote:
Here is an XSLT 2.0 stylesheet that produces the tables you want but not in the order you have in the sample you posted. I am not sure what determines the order in that posted sample thus I have not tried to use xsl:sort to change the order.
<xsl:output method="html" indent="yes"/>
<xsl:param name="empty" select="''"/>
<xsl:template match="/">
<html>
<head>
<title>TEST</title>
</head>
<body>
<xsl:for-each-group select="CertificationSheets/Sheet"
group-by="if (PlanningData/WorkArea) then PlanningData/WorkArea else $empty">
<xsl:variable name="wa" select="current-grouping-key()"/>
<xsl:for-each-group select="current-group()"
group-by="if (PlanningData/SkillRequirement/Skill) then PlanningData/SkillRequirement/Skill else $empty">
<p>Work Area: <xsl:value-of select="$wa"/></p>
<p>Skill: <xsl:value-of select="current-grouping-key()"/></p>
<table border="1">
<thead>
<tr>
<th>Trn #</th>
<th>Type</th>
</tr>
</thead>
<tbody>
<xsl:for-each select="current-group()">
<tr>
<td><xsl:value-of select="Summary/WorkOrderInfo/TransactionNo"/></td>
<td><xsl:value-of select="Detail/Task/Type"/></td>
</tr>
</xsl:for-each>
</tbody>
</table>
</xsl:for-each-group>
</xsl:for-each-group>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
--
Re: [xsl] Re: Problem with grouping on elements that are not always present
Subject: Re: [xsl] Re: Problem with grouping on elements that are not always present From: Martin Honnen <Martin.Honnen@xxxxxx> Date: Thu, 12 Aug 2010 12:59:45 +0200 |
Dieter Schmerlaib wrote:
The reason that 2.0 is I am planning to transition to 2.0. So a for-each-group may work the out put I want is below I am missing Transactions 1,2,8 ie where there is no skill requirement.
Here is an XSLT 2.0 stylesheet that produces the tables you want but not in the order you have in the sample you posted. I am not sure what determines the order in that posted sample thus I have not tried to use xsl:sort to change the order.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:output method="html" indent="yes"/>
<xsl:param name="empty" select="''"/>
<xsl:template match="/">
<html>
<head>
<title>TEST</title>
</head>
<body>
<xsl:for-each-group select="CertificationSheets/Sheet"
group-by="if (PlanningData/WorkArea) then PlanningData/WorkArea else $empty">
<xsl:variable name="wa" select="current-grouping-key()"/>
<xsl:for-each-group select="current-group()"
group-by="if (PlanningData/SkillRequirement/Skill) then PlanningData/SkillRequirement/Skill else $empty">
<p>Work Area: <xsl:value-of select="$wa"/></p>
<p>Skill: <xsl:value-of select="current-grouping-key()"/></p>
<table border="1">
<thead>
<tr>
<th>Trn #</th>
<th>Type</th>
</tr>
</thead>
<tbody>
<xsl:for-each select="current-group()">
<tr>
<td><xsl:value-of select="Summary/WorkOrderInfo/TransactionNo"/></td>
<td><xsl:value-of select="Detail/Task/Type"/></td>
</tr>
</xsl:for-each>
</tbody>
</table>
</xsl:for-each-group>
</xsl:for-each-group>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
--
Martin Honnen http://msmvps.com/blogs/martin_honnen/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Re: Problem with grouping on , Dieter Schmerlaib | Thread | [xsl] Howto follow embedded Xpaths , Daniel Laird |
Re: [xsl] Howto follow embedded Xpa, Michael Kay | Date | Re: [xsl] Howto follow embedded Xpa, Hermann Stamm-Wilbra |
Month |
Keywords