Expand|Select|Wrap|Line Numbers
- <book>
- <title>
- <author>
- <book>
- : : :
I need XSLT to produce a listing of books where <author> = "user supplied string". But, if not match occurs, then I want to display "No matches found" instead.
So - in my extremely novice experience, I code something like:
Expand|Select|Wrap|Line Numbers
- <xsl:template match="/">
- <xsl:for-each select="book">
- <xsl:if test="author='usersuppliedstring'">
- <xsl:value-of select="title"> <br />
- </xsl:if>
- </xsl:for-each>
- </xsl:template>
And - what if the <xsl:if ...> test is more complex and nested? I need to see if anything in the middle was selected - or in other words, count how many matches were output and if the count is zero, output "No matches found".
Thanks,
Jeff