positioning

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

positioning

Bruce D'Arcus
I played a bit with figuring out how to handle the number and note  
class positioning issues.

Maybe this is a start?

<!-- grab all the citation pointers -->
    <xsl:variable name="citerefs" select="//db:biblioref/@linkend"/>

    <xsl:variable name="cite-position">
       <bib:refs>
          <bib:all>
             <xsl:for-each select="$citerefs">
                <bib:ref position="{position()}" id="{generate-id()}"  
key="{.}" />
             </xsl:for-each>
          </bib:all>
          <bib:unique>
           <xsl:for-each-group select="$citerefs" group-by=".">
             <bib:ref position="{position()}" id="{generate-id()}"  
key="{.}" />
           </xsl:for-each-group>
          </bib:unique>
       </bib:refs>
    </xsl:variable>

Result:

             <bib:refs>
                <bib:all>
                   <bib:ref position="1" id="d1e12a1745"  
key="Tilly2000a"></bib:ref>
                   <bib:ref position="2" id="d1e13a1745"  
key="Thrift1990a"></bib:ref>
                   <bib:ref position="3" id="d1e14a1745"  
key="TimesP2001a"></bib:ref>
                   <bib:ref position="4" id="d1e19a1745"  
key="Veer1996a"></bib:ref>
                   <bib:ref position="5" id="d1e25a1745"  
key="Tilly2000a"></bib:ref>
                </bib:all>
                <bib:unique>
                   <bib:ref position="1" id="d1e12a1745"  
key="Tilly2000a"></bib:ref>
                   <bib:ref position="2" id="d1e13a1745"  
key="Thrift1990a"></bib:ref>
                   <bib:ref position="3" id="d1e14a1745"  
key="TimesP2001a"></bib:ref>
                   <bib:ref position="4" id="d1e19a1745"  
key="Veer1996a"></bib:ref>
                </bib:unique>
             </bib:refs>

My thought is that with, for example, the number class, you can then do:

   <xsl:template match="db:citation">
     <xsl:text>[</xsl:text>
       <xsl:for-each select="db:biblioref">
         <xsl:apply-templates select="." />
         <xsl:if test="not(position() = last())">
           <xsl:text>, </xsl:text>
         </xsl:if>
       </xsl:for-each>
     <xsl:text>]</xsl:text>
   </xsl:template>

   <xsl:template match="db:biblioref">
     <xsl:variable name="linkend" select="@linkend"/>
     <xsl:value-of
             
select="$cite-position/bib:refs/bib:unique/bib:ref[@key=$linkend]/
@position" />
   </xsl:template>

Am not sure how the logic that'd work to get, for example,  
first/subsequent footnotes.

Bruce