R
reclusive monkey
I followed the instructions from the all-knowing Ms. Tennison here;
http://www.biglist.com/lists/xsl-list/archives/200101/msg00070.html
And it works great for the first two levels. However, when I tried to
apply it to three levels, the third level just doesn't show. I am sure
its something obvious but I just can't spot it. Can anyone see where I
have gone wrong? Thanks in advance.
Sample from XML file;
<qrySubjectiveBuild1>
<FLDivisionA>0</FLDivisionA>
<FLDivisionADescription>Employees</FLDivisionADescription>
<FLDivisionB>00</FLDivisionB>
<FLDivisionBDescription>Salaries</FLDivisionBDescription>
<SubjectiveCode>0000</SubjectiveCode>
<SubjDesc>Teaching Staff- Teachers Scheme</SubjDesc>
<CentrallyControlled>0</CentrallyControlled>
<SCSDNonUse>0</SCSDNonUse>
</qrySubjectiveBuild1>
<qrySubjectiveBuild1>
<FLDivisionA>0</FLDivisionA>
<FLDivisionADescription>Employees</FLDivisionADescription>
<FLDivisionB>00</FLDivisionB>
<FLDivisionBDescription>Salaries</FLDivisionBDescription>
<SubjectiveCode>0001</SubjectiveCode>
<SubjDesc>Tutors</SubjDesc>
<CentrallyControlled>0</CentrallyControlled>
<SCSDNonUse>0</SCSDNonUse>
</qrySubjectiveBuild1>
(goes from 0001 to 9999 essentially)
and the extract from the XSL file (the page displays fine, just without
the third digit level, so I am happy the issue is within this code)
Keys at top of XSL file;
<xsl:key name="first-digit" match="qrySubjectiveBuild1"
use="FLDivisionA"/>
<xsl:key name="second-digit" match="qrySubjectiveBuild1"
use="concat(FLDivisionA,' ',FLDivisionB)"/>
<xsl:key name="third-digit" match="qrySubjectiveBuild1"
use="concat(FLDivisionA,' ',FLDivisionB,' ',SubjectiveCode)"/>
Grouping code;
<ul>
<xsl:for-each
select="//qrySubjectiveBuild1[generate-id(.)=generate-id(key('first-digit',FLDivisionA))]">
<xsl:sort select="FLDivisionA"/>
<li><a name="{FLDivisionADescription}"><xsl:value-of
select="FLDivisionA" /> - <xsl:value-of
select="FLDivisionADescription" /></a></li>
<ul>
<xsl:variable name="level2group" select="key('first-digit',
FLDivisionA)" />
<xsl:for-each
select="$level2group[generate-id()=generate-id(key('second-digit',concat(FLDivisionA,'
',FLDivisionB))[1])]">
<li><xsl:value-of select="FLDivisionB" /> - <xsl:value-of
select="FLDivisionBDescription" /></li>
<ul>
<xsl:variable name="level3group"
select="key('second-digit',FLDivisionB)" />
<xsl:for-each
select="$level3group[generate-id()=generate-id(key('third-digit',concat(FLDivisionA,'
',FLDivisionB,' ',SubjectiveCode))[1])]">
<li><xsl:value-of select="SubjectiveCode" /> - <xsl:value-of
select="SubjDesc" /></li>
</xsl:for-each>
</ul>
</xsl:for-each>
</ul>
</xsl:for-each>
</ul>
http://www.biglist.com/lists/xsl-list/archives/200101/msg00070.html
And it works great for the first two levels. However, when I tried to
apply it to three levels, the third level just doesn't show. I am sure
its something obvious but I just can't spot it. Can anyone see where I
have gone wrong? Thanks in advance.
Sample from XML file;
<qrySubjectiveBuild1>
<FLDivisionA>0</FLDivisionA>
<FLDivisionADescription>Employees</FLDivisionADescription>
<FLDivisionB>00</FLDivisionB>
<FLDivisionBDescription>Salaries</FLDivisionBDescription>
<SubjectiveCode>0000</SubjectiveCode>
<SubjDesc>Teaching Staff- Teachers Scheme</SubjDesc>
<CentrallyControlled>0</CentrallyControlled>
<SCSDNonUse>0</SCSDNonUse>
</qrySubjectiveBuild1>
<qrySubjectiveBuild1>
<FLDivisionA>0</FLDivisionA>
<FLDivisionADescription>Employees</FLDivisionADescription>
<FLDivisionB>00</FLDivisionB>
<FLDivisionBDescription>Salaries</FLDivisionBDescription>
<SubjectiveCode>0001</SubjectiveCode>
<SubjDesc>Tutors</SubjDesc>
<CentrallyControlled>0</CentrallyControlled>
<SCSDNonUse>0</SCSDNonUse>
</qrySubjectiveBuild1>
(goes from 0001 to 9999 essentially)
and the extract from the XSL file (the page displays fine, just without
the third digit level, so I am happy the issue is within this code)
Keys at top of XSL file;
<xsl:key name="first-digit" match="qrySubjectiveBuild1"
use="FLDivisionA"/>
<xsl:key name="second-digit" match="qrySubjectiveBuild1"
use="concat(FLDivisionA,' ',FLDivisionB)"/>
<xsl:key name="third-digit" match="qrySubjectiveBuild1"
use="concat(FLDivisionA,' ',FLDivisionB,' ',SubjectiveCode)"/>
Grouping code;
<ul>
<xsl:for-each
select="//qrySubjectiveBuild1[generate-id(.)=generate-id(key('first-digit',FLDivisionA))]">
<xsl:sort select="FLDivisionA"/>
<li><a name="{FLDivisionADescription}"><xsl:value-of
select="FLDivisionA" /> - <xsl:value-of
select="FLDivisionADescription" /></a></li>
<ul>
<xsl:variable name="level2group" select="key('first-digit',
FLDivisionA)" />
<xsl:for-each
select="$level2group[generate-id()=generate-id(key('second-digit',concat(FLDivisionA,'
',FLDivisionB))[1])]">
<li><xsl:value-of select="FLDivisionB" /> - <xsl:value-of
select="FLDivisionBDescription" /></li>
<ul>
<xsl:variable name="level3group"
select="key('second-digit',FLDivisionB)" />
<xsl:for-each
select="$level3group[generate-id()=generate-id(key('third-digit',concat(FLDivisionA,'
',FLDivisionB,' ',SubjectiveCode))[1])]">
<li><xsl:value-of select="SubjectiveCode" /> - <xsl:value-of
select="SubjDesc" /></li>
</xsl:for-each>
</ul>
</xsl:for-each>
</ul>
</xsl:for-each>
</ul>