Source type modifier must match XML instance

For an example, an XML instance document contains this content:

<root>
        <child xsi:type="realtype" realattr="foo"/>
<root>

The XML path that is used to select the value of myrealtypeattr is:

root.child{realtype}.&realattr --> @attrValue

In this example, if the specified type is not correct, then this is also not correct:

root.child{otherrealtype}.&realattr --> @attrValue

Because the instance has a defined child’s type as realtype, this type modifier is incorrect and produces this error:

XML Path Resolution Error: The specified element child of type realtype does not match path type modifier otherrealtype.