I don't know what you're trying to achieve here, but what your code actually does is that every time you process a table element (xsl:template match="table") you are asking it to process every table element in the whole document (xsl:apply-templates select="//table") including of course the table where you started. So this will give you infinite recursion (or it would, if the processor had an infinite stack).
Michael Kay
http://saxon.sf.net/