I can't really follow your logic. You seem to be numbering elements based on the presence of an @class attribute, but in your XML source none of the elements has a @class attribute.
If it's true that
match="*[contains(@class,' topic/topic ')]/*[contains(@class,' topic/title ')]"
matches all the elements you want to number, and only the ones you want to number, then you should be able to use
<xsl:number count=" match="*[contains(@class,' topic/topic ')]/*[contains(@class,' topic/title ')]" level="any"/>
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference