xsl-list
[Top] [All Lists]

[xsl] counting nodes question

2006-11-25 13:58:30
Hello,

I have a "NOTE" element that lets the author add notes and automatically
counts the Note number. I am trying to figure out when there is only one
note element, it doesn't use the <xsl:number>. I tried xsl:if, xsl:choose
and xsl:when. I keep getting hung up on determining if the count is greater
1.


Here is what my XSLT template looks like (XSLT 1.0)
I use the MSXML processor in IE


<xsl:template match="ACM:NOTE">
        <xsl:for-each select="ACM:Para">
                <span style="font-family:Arial; font-weight:bold;
text-decoration:underline; position:absolute; ">NOTE:
                        <xsl:number level="single" format="1"
count="ACM:NOTE"/>
                </span>
                <span style="width:100%; font-weight:bold;
padding-left:70px; ">
                        <xsl:apply-templates/>
                </span>
                <br/>
        </xsl:for-each>
</xsl:template>

This is how it outputs in HTML:

NOTE: 1 XX This is a multi-note
NOTE: 2 XXXX More notes

NOTE: 1 XX This is a single note

My XML:
<policy>
        <Para tr="1" change="0">Marked TR</Para>
        <Para>
                <NOTE>
                        <Para> XX This is a multi-note</Para>
                </NOTE>
                <NOTE>
                        <Para>XXXX More notes</Para>
                </NOTE>
        </Para>
        <Para>
                <NOTE>
                        <Para>XX This is a single note</Para>
                </NOTE>
        </Para>
</policy>

Desired output: Notice that if there is only one child of ACM:Para it
doesn't count.

NOTE: 1 XX This is a multi-note
NOTE: 2 XXXX More notes

NOTE: XX This is a single note



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>