<xsd:any/>
does not really match "any" element - rather, it matches any element declared somewhere in a schema in scope.
For example, the following schema defines an element containing xsd:any:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.example.com/">
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:any/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Nevertheless, the following query will fail:
import schema namespace my = "http://www.example.com/";
validate { <my:root><my:Child/></my:root> }
because my:Child is declared nowhere.
If the schema is modified as follows:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.example.com/">
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:any/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Child" type="xs:anyType"/>
</xs:schema>
then the query should succeed. Of course the element matched by xsd:any may be in another namespace.