.NET and matching namespace with wildcard using XPath

.NET framework’s XslCompiledTransform only supports XPath and XSLT 1.0.

With XPath 1.0 ‘*’ is allowed to select all elements and nisse:* is allowed to select all elements in the namespace bound to the prefix ‘nisse’ but *:nisse to select ‘nisse’ elements in all
namespaces is not allowed in XPath 1.0, see http://www.w3.org/TR/xpath#node-tests.

And here is an example in vb.net where InnerText is read from the nameOfElementToFind in any name space

' This is the xmlnode the search is done with
Dim node As XmlNode = FetchSomeNode()
 
Dim innerTextFromNode As String = String.Empty
Dim xPathToSearchFor As String = String.Empty
 
'Will find all direct decendants nameOfElementToFind in any name space
xPathToSearchFor = "*[local-name() 'nameOfElementToFind']" 
 
'Will find all nameOfElementToFind in any name space and anywhere under this node
xPathToSearchFor = ".//*[local-name() 'nameOfElementToFind']" 
 
'Will find all nameOfElementToFind in any name space and anywhere in the document the node belongs to
xPathToSearchFor = "//*[local-name() 'nameOfElementToFind']"
 
If (node IsNot Nothing) Then
	innerTextFromNode = node.selectSingleNode(xPathToSearchIn).InnerText
End If