RE: [xsl] Using XSLT 1.0 , I have tried using the Meunchian methodsolutions on

Subject: RE: [xsl] Using XSLT 1.0 , I have tried using the Meunchian methodsolutions on
From: "Brian Martinez" <Brian.Martinez@xxxxxxxxxxxx>
Date: Tue, 19 Dec 2006 15:01:57 -0700
A quick and dirty way:

<xsl:if test="position() = 1">
	<div>
            <xsl:value-of select="AgencyName"/>
      </div>
</xsl:if>

This will display AgencyName only on the first occurrence of the nodes
selected by your key.  Note, however, that your key only groups by
FilingType--if you have multiple AgencyNames with the same FilingType
only the first occurrence of AgencyName will appear.

You can fix this by expanding your key:

  <xsl:key name="tar_by_filingtype" match="MonthlyTARList"
use="concat(FilingType, ' ', AgencyName)"/>

Then change your for-each to use

key('tar_by_filingtype', concat(FilingType, ' ', AgencyName))

hth,
b.

> -----Original Message-----
> From: Robert.A Greene [mailto:Robert.A.Greene@xxxxxxxxxxx]
> Sent: Tuesday, December 19, 2006 1:37 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Using XSLT 1.0 , I have tried using the Meunchian
> methodsolutions on
>
> Using XSLT 1.0 , I have tried using the Meunchian method solutions on
> the list but I can not get the following to group by FilingType then
> AgencyName:
>
> <MonthlyTARList>
> <FilingType>Rulemaking Hearings</FilingType>
> <AgencyName>Agriculture</AgencyName>
> <Filing>0080-06-14 Pest Control Operators</Filing>
>
<Link>http://www.tn.gov/sos/rules_hearingnotices/2006/0080/0080.20061114
.1
> 1-05-06.notice.pdf</Link>
> </MonthlyTARList>
> <MonthlyTARList>
> <FilingType>Rulemaking Hearings</FilingType>
> <AgencyName>Agriculture</AgencyName>
> <Filing>0080-06-15 Interior Designers</Filing>
>
<Link>http://www.tn.gov/sos/rules_hearingnotices/2006/0120/0120.20061130
.1
> 1-27-06.notice.pdf</Link>
> </MonthlyTARList>
>
> So that the file reads:
>
> Rulemaking Hearings
> Agriculture
> 0080-06-14 Pest Control Operators
> 0080-06-15 Interior Designers
>
> What I have so far (grouping by FilingType only):
>
> <xsl:key name="tar_by_filingtype" match="MonthlyTARList"
> use="FilingType"/><xsl:template match="dataroot">
>
> <xsl:for-each select="MonthlyTARList[count(. |
key('tar_by_filingtype',
> FilingType)[1])=1]">
>     <xsl:sort select="FilingType" />
>            <div class="headline1_xml"><xsl:value-of
> select="FilingType"/></div>
>     <xsl:for-each select="key('tar_by_filingtype', FilingType)">
>           <div class="text_xml"><xsl:value-of
> select="AgencyName"/></div>
>         <div><xsl:value-of select="Filing"/></div>
>
> thanks for any help,
>
>
> Robert Greene
> Tennessee Department of State
> Division of Publications
> 312 8th Ave. North, 8th Floor
> Nashville, TN 37243
> (615) 253-4571
> FAX (615) 741-5133
> http://www.tennessee.gov/sos

Current Thread