[Home] [By Thread] [By Date] [Recent Entries]
Alice Ju-Hsuan Wei wrote:
Hi, I think you mean: books with multiple titles but with one author the titles would be broken off with the <p> tag, but those with only one, would not display the <p> tag. Anyone know if I should use <xsl:if> or the count function here? That is quite a generic question. In general, it is probably not needed to use xsl:if. And yes, you can use the count function. When you are in the context of <book>, you can use count(title) to find out. When you design the matching template for <title>, just change it to be <xsl:template match="title[1]" to match only the first title and make a throw away generic template for the rest. <!-- first title --> <xsl:template match="title[1]"> <p><xsl:apply-templates /></p> </xsl:template> <!-- throw away --> <xsl:template match="title" /> If you don't want to do anything with count, this is it. Alternatively, you can simplify matters by changing your select statement instead. But that is a matter of taste and context. Cheers, -- Abel Braaksma
|

Cart



