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

Auto-Numbering with conditions

Subject: Auto-Numbering with conditions
From: waldron.Navix@xxxxxxxxxxx
Date: Fri, 16 May 2003 13:37:20 +0900
auto numbering
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&#x2003;" />
            <xsl:apply-templates />
        </span>
        </xsl:when>
        <xsl:otherwise>
        <span style="display:block; ">
            <xsl:text>&#x2022;&#x2003;</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


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.