[Home] [By Thread] [By Date] [Recent Entries]
John Horner wrote:
There are many ways that lead to Rome. It can be done very short in XSLT 2, but I guess you are using XSLT 1. Here's one way to tackle it, using only template matching, which will output the number "1" is there is no image with @default, and will print the position of the one with @default when there is one. <xsl:template match="/"> pos2: <xsl:apply-templates select="$gallery-xml-file/gallery/image" /> </xsl:template> <xsl:template match="image[@default] | image[not(../image/@default)][1]"> <xsl:value-of select="position()" /> </xsl:template> <xsl:template match="image" />
|

Cart



