Subject: [xsl] a nicer total sibling count than this From: scruss@xxxxxxxxxxxx Date: Wed, 18 Sep 2002 15:39:29 -0400 |
I'm working with a dictionary marked up in XML. Conventionally, one numbers definitions (def elements here) only if there are two or more definitions for the given part of speech. To my surprise and delight, the following worked, producing heavy def numbers with a following non-break space: <xsl:template match="def"> <xsl:if test="(count(preceding-sibling::def) + count(following-sibling::def)) >= 1"> <xsl:element name="strong"> <xsl:number/> <xsl:text> </xsl:text> </xsl:element> </xsl:if> <xsl:apply-templates/> </xsl:template> Is there a prettier/more efficient way of doing the same thing without resorting to frankly ugly '(count(preceding-sibling::def)+count(following-sibling::def))'? thanks, Stewart XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] generating xsl on the fly, Bruce Gagnon | Thread | Re: [xsl] a nicer total sibling cou, Jeni Tennison |
RE: [xsl] Problem with using $varia, Stuart Brown | Date | RE: [xsl] xsl array alternatives (n, Stuart Brown |
Month |