code: private ComparisonState compareXsiType(Attr controlAttr,
                                             XPathContext controlContext,
                                             Attr testAttr,
                                             XPathContext testContext) {
          boolean mustChangeControlContext = controlAttr != null;
          boolean mustChangeTestContext = testAttr != null;
          if (!mustChangeControlContext && !mustChangeTestContext) {
              return new OngoingComparisonState();
          }
          boolean attributePresentOnBothSides = mustChangeControlContext
              && mustChangeTestContext;
  
          try {
              QName controlAttrName = null;
              if (mustChangeControlContext) {
                  controlAttrName = Nodes.getQName(controlAttr);
                  controlContext.addAttribute(controlAttrName);
                  controlContext.navigateToAttribute(controlAttrName);
              }
              QName testAttrName = null;
              if (mustChangeTestContext) {
                  testAttrName = Nodes.getQName(testAttr);
                  testContext.addAttribute(testAttrName);
                  testContext.navigateToAttribute(testAttrName);
              }
              return
                  compare(new Comparison(ComparisonType.ATTR_NAME_LOOKUP,
                                         controlAttr, getXPath(controlContext),
                                         controlAttrName, getParentXPath(controlContext),
                                         testAttr, getXPath(testContext),
                                         testAttrName, getParentXPath(testContext)))
                  .andIfTrueThen(attributePresentOnBothSides,
                                 compareAttributeExplicitness(controlAttr, controlContext,
                                                              testAttr, testContext))
                  .andIfTrueThen(attributePresentOnBothSides,
                                 new Comparison(ComparisonType.ATTR_VALUE,
                                                controlAttr, getXPath(controlContext),
                                                valueAsQName(controlAttr), getParentXPath(controlContext),
                                                testAttr, getXPath(testContext),
                                                valueAsQName(testAttr), getParentXPath(testContext)));
          } finally {
              if (mustChangeControlContext) {
                  controlContext.navigateToParent();
              }
              if (mustChangeTestContext) {
                  testContext.navigateToParent();
              }
          }
      }
docs: Compares xsi:type attribute values