Hi,
I'm continuing to struggle with this problem. A certain class of manual here
uses a numbered step by step instruction on how to operate features of the
product (using xsl:number). Except if the instruction has only one step, then it
outputs a bullet instead of a single "1". Instructions with 1-9 steps are also
formatted differently than instructions with 10 or more steps. This later part
is whats got me stumped.
So, a snip of the xml code looks like this:
<blockquote>
<step>
<text>This would be step one, auto-numbering appled if more than one
step.</text>
<explain>This is optional, if additional explaination is
needed.</explain>
</step>
<step>
<text>This would be step two, auto-numbering appled if more than one
step.</text>
<explain>This is optional, if additional explaination is
needed.</explain>
</step>
<!--Continues as needed-->
</blockquote>
And the XSL that I'm using at the moment looks something like this:
<!--Step by step instruction element with conditional auto-numbering-->
<xsl:template match="step">
<xsl:choose>
<xsl:when test="count(../step)>1">
<span style="display:block; ">
<xsl:number format="1 " />
<xsl:apply-templates />
</span>
</xsl:when>
<xsl:otherwise>
<span style="display:block; ">
<xsl:text>• </xsl:text>
<xsl:apply-templates />
</span>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
At a bare minimum, this works. If there is more than one step element it
auto-numbers, otherwise it outputs the bullet.
But, what I really want is to modify the conditions so that when there is more
than one and less than 10 steps I can apply styles "abc" and when there is more
than 10 or more steps, apply styles "xyz".
I now understand part of the problem I was fighting trying to use this code,
that it was counting the total number of step elements inside each blockquote
container and not the step elements individually.
Can anyone offer a solution?
Thanks!
Dee Waldron
Tokyo Japan
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list