Re: [xsl] xsl:number and conditional

Subject: Re: [xsl] xsl:number and conditional
From: Bruce D'Arcus <bdarcus@xxxxxxxxx>
Date: Tue, 31 May 2005 18:12:16 -0400
OK, ok,I went back to a stripped down example of this that had worked,
and played with it a bit.

Example:

<doc>
  <p>a <citation/> and a <footnote>and a <citation/> in a
footnote</footnote> and a <citation/></p>
</doc>

Correctly working stylesheet:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns:xs="http://www.w3.org/2001/XMLSchema";
xmlns:bib="http://purl.org/NET/xbiblio/citeproc";
  exclude-result-prefixes="xs bib" version="2.0">

  <xsl:template match="doc">
    <list>
      <xsl:apply-templates
select="//footnote|//citation[not(ancestor::footnote)]"/>
    </list>
  </xsl:template>

  <xsl:template match="p">
    <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="footnote">
    <number>
      <xsl:value-of select="bib:footcite(.)"/>
      <xsl:apply-templates select="citation"/>
    </number>
  </xsl:template>

  <xsl:template match="citation">
    <number>
      <xsl:value-of select="bib:footcite(.)"/>
    </number>
  </xsl:template>

  <xsl:template match="citation[ancestor::footnote]">
    <nonumber/>
  </xsl:template>

  <xsl:function name="bib:footcite" as="xs:string">
    <xsl:param name="footciteable" as="element()"/>
    <xsl:for-each select="$footciteable">
      <xsl:number level="any" select="."
count="footnote|citation[not(ancestor::footnote)]"/>
    </xsl:for-each>
  </xsl:function>

</xsl:stylesheet>

Yields this output:

<list>
   <number>1</number>
   <number>2<nonumber/>
   </number>
   <number>3</number>
</list>

Now, if I change the function to this:

  <xsl:function name="bib:footcite" as="xs:string">
    <xsl:param name="footciteable" as="element()"/>
    <xsl:number level="any" select="$footciteable"
count="footnote|citation[not($footciteable/ancestor::footnote)]"/>
  </xsl:function>

I get:

<list>
   <number>1</number>
   <number>2<nonumber/>
   </number>
   <number>4</number>
</list>

Saxon (8.4) will not allow me to remove the $footcitable on the count,
nor to add it as context to the footnote.

So is this a bug?

Bruce

Current Thread