position variables

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

position variables

Bruce D'Arcus
OK,

I tried to figure out how to apply David's fix for one part of the
grouping problem to the rest, since this bug MUST get fixed ASAP.  So,
I tried to create a new variable ("author-position") to  figure out the
position within an author group.  Here's what I have:

                 <xsl:when test="$sort_order-bib='author-year'">
                     <xsl:for-each
select="$raw-biblist/mods:modsCollection">
                         <xsl:variable name="bibref" select="mods:mods"/>
                         <xsl:for-each-group select="$bibref"
                             group-by="bib:grouping-key(.)">
                             <xsl:sort select="current-grouping-key()"/>

                             <xsl:variable name="author-position"
select="position()"/>

                             <xsl:for-each-group select="current-group()"
                                 group-by="bib:year(.)">
                                 <xsl:sort
select="current-grouping-key()"/>
                                 <xsl:variable name="author-year-count"
                                     select="count(current-group())"/>
                                 <xsl:apply-templates
select="current-group()"
                                     mode="current-group">
                                     <xsl:with-param
name="author-year-count"
                                         select="$author-year-count"/>
                                     <xsl:with-param
name="author-position"
                                         select="$author-position"/>
                                 </xsl:apply-templates>
                             </xsl:for-each-group>
                         </xsl:for-each-group>
                     </xsl:for-each>
                 </xsl:when>

However, I get this result on the sample file:

  Current author-year position: 1 Current author position: 1
  Current author-year position: 1 Current author position: 2
  Current author-year position: 2 Current author position: 2
  Current author-year position: 1 Current author position: 3
  Current author-year position: 1 Current author position: 4
  Current author-year position: 1 Current author position: 4
  Current author-year position: 1 Current author position: 5
  Current author-year position: 1 Current author position: 6

What I expect is:

  Current author-year position: 1 Current author position: 1
  Current author-year position: 1 Current author position: 1
  Current author-year position: 2 Current author position: 2
  Current author-year position: 1 Current author position: 1
  Current author-year position: 1 Current author position: 1
  Current author-year position: 1 Current author position: 2
  Current author-year position: 1 Current author position: 1
  Current author-year position: 1 Current author position: 1

Any ideas?

Bruce