[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl] counting nodes question
Subject: [xsl] counting nodes question From: "Philip Vallone" <philip.vallone@xxxxxxxxxxx> Date: Sat, 25 Nov 2006 15:57:43 -0500 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] group-by sorting and paging p, Robert Wilkins | Thread | Re: [xsl] counting nodes question, J.Pietschmann |
Re: [xsl] Standards checkers for XS, Dimitre Novatchev | Date | [xsl] RDF/OWL Transformation using , John Smith |
Month |
Keywords