A quick aside - Saxon and AltovaXML can both be used with .Net, so you are not restricted to XSLT 1.0 along just because you are using VB
The contains function takes two strings as arguments, therefore the above will create the the string representation of the node set containing every node in the document - which seeing as in XSLT 1.0 this will simply be the text value of the first node, which will probably be the root node, and hence the text value of the entire tree the following will probably do the same test="contains(., $search)"
Also a 'feature' is that the contains function would return true if the XML input contained "<root><element>1</element><element>2</element></root>" and you searched for "12".
Lastly your inner for-each will just loop through every node in the tree and output the <xsl:number> for each.
Perhaps <xsl:for-each select="//*[contains(text(), $search)"> might be a better way of doing this.
/- Sam Judson : Wrox Technical Editor -/