[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: xsl:number and conditional

Subject: RE: xsl:number and conditional
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 31 May 2005 23:10:54 +0100
xsl consecutive numbers
> $footcite in this context is a function parameter that is defined as
> element(), but in practice is either db:footnote or db:citation.  So I
> have:
> 
>   <xsl:function name="bib:number-footcite" as="xs:string">
>     <xsl:param name="footcite" as="element()"/>
>     <xsl:choose>
>       <xsl:when test="$chapters/db:chapter">
>         <xsl:number level="any" select="$footcite"
>           
> count="db:footnote|db:citation[not($footcite/ancestor::db:footnote)]"
> from="db:chapter"/>
>       </xsl:when>
>       <xsl:otherwise>
>         <xsl:number level="any" select="$footcite"
>           
> count="db:footnote|db:citation[not($footcite/ancestor::db:foot
> note)]"/>
>       </xsl:otherwise>
>     </xsl:choose>
>   </xsl:function>

Does a footnote ever have a footnote as an ancestor? If not then
> 
> I then call the function in those templates like so:
> 
> 	<xsl:template match="db:citation">
> 	  <xsl:choose>
> 	    <xsl:when test="$citeclass='note-bib' or 
> $citeclass='note-nobib'">
> 	      <xsl:variable name="footnote-number">
> 	        <xsl:value-of select="bib:number-footcite(.)"/>
> 	      </xsl:variable>


Don't do this, do 
  <xsl:variable name="footnote-number" select="bib:number-footcite(.)"/>


I think the important thing here is that if you want consecutive numbers,
the elements you call xsl:number on must be the same elements that you match
in the count="" pattern of xsl:number. It's not obvious from your code that
this is the case here: but without the source structure and information
about when this template is being invoked, it's impossible to tell.

Michael Kay
http://www.saxonica.com/



> 	      <xsl:text>[</xsl:text>
> 	      <a href="#fn{$footnote-number}" 
> name="fnm{$footnote-number}"
> class="footnote-mark">
> 	        <xsl:value-of select="$footnote-number"/>
> 	      </a>
> 	      <xsl:text>]</xsl:text>
> 	    </xsl:when>
> 	    <xsl:otherwise>
> 	      <xsl:call-template name="bib:format-citation">
> 	        <xsl:with-param name="output-format" select="'xhtml'"/>
> 	      </xsl:call-template>
> 	    </xsl:otherwise>
> 	  </xsl:choose>
> 	</xsl:template>
> 
> So if I don't specify not to count db:citation elements that are
> descendents of db:footnote, they get double-counted.
> 
> Bruce

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.