Re: parameter count in xsl:number

Subject: Re: parameter count in xsl:number
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Sun, 10 Sep 2000 19:13:06 +0100
Paul,

>I'm trying to pass an element as parameter for a named template, to be used 
>in a xsl:number expression. I use it like this :
>
>             <xsl:number level="any"
>                         format="_1"
>                         count="$element"/>
>
>My processor (Oracle) is complaining that there is an error in the 
>expression. If I try name($element) or string($element), same thing. Any 
>idea what kind of expression it expects ?

The 'count' attribute on xsl:number expects a pattern that matches the
nodes you're interested in counting to make up the number.  So something like:

  <xsl:number level="any" format="1." count="footnote" />

would give the number of 'footnote' elements appearing before the current
node in the document, including the current node if it's a 'footnote'
element itself.

You can't use a parameter for the 'count' attribute, so you're probably
stuck doing something like:

  <xsl:choose>
    <xsl:when test="$element = 'type1'">
      <xsl:number level="any" format="_1" count="type1" />
    </xsl:when>
    <xsl:when test="$element = 'type2'">
      <xsl:number level="any" format="_1" count="type2" />
    </xsl:when>
  </xsl:choose>

and so on, although another solution may be apparent if you give more
details about what you're trying to achieve.

Sorry not to be more help,

Jeni

Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread