[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] testing for numbers of nodes
Dear Friends,
I'm trying my hand at XSLT for the first time in few years, trying to get a dictionary ready for print-out. I've got just about everything working, but I'm having trouble with one point. In the explanatory section of each entry, I have this structure: <headword>The Term</headword> <sense_area> <sense>Explanation of meaning #1</sense> <sense>Explanation of meaning #2</sense> <sense>Explanation of meaning #3</sense> </sense_area> I want this to be in inline paragraph format, not list format, so I have used <xsl:number>, so that I can output something like this: The Term: (I) Explanation of meaning 1. (II) Explanation of meaning 2. (III) Explanation of meaning 3. I did this with: <xsl:for-each select="sense_area"><xsl:text> </xsl:text> <xsl:for-each select="sense"> (<xsl:number format="I"/>)<xsl:apply-templates /> </xsl:for-each> </xsl:for-each> I'm OK up to here with the XSL, but the only problem is, if there is only one <sense> I don't want any numbers at all. So I assume that I need to do a test, which will turn off numbering if the amount of <sense> is not greater than one. So I've tried a few things using count(), without success. I've been playing with this for a while now, and can't make anything work. The present code I've got (not working) is: <xsl:for-each select="sense_area"><xsl:text> </xsl:text> <xsl:for-each select="sense"> <xsl:if test="count(sense) > I">(<xsl:number format="I"/>)</xsl:if> <xsl:apply-templates /> </xsl:for-each> </xsl:for-each> Can someone perhaps see what is wrong with this? Thank you very much. Chuck -- --------------------------- Charles Muller Toyo Gakuen University Faculty of Humanities 1660 Hiregasaki, Nagareyama-shi Chiba 270-0161 JAPAN Mobile Phone: 090-9310-1787 Web Site: Resources for East Asian Language and Thought http://www.acmuller.net <acmuller[at]jj.em-net.ne.jp>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|