private static Reference createXpathReferenceForDisponent(XMLSignatureFactory signatureFactory)
        throws InvalidAlgorithmParameterException, NoSuchAlgorithmException {
    DigestMethod digestMethod = signatureFactory.newDigestMethod(DigestMethod.SHA256, null);

    List<Transform> transforms = new ArrayList<>();
    Transform excCanonicalization =
            signatureFactory.newTransform(CanonicalizationMethod.EXCLUSIVE, (TransformParameterSpec) null);

    XPathFilterParameterSpec spec = new XPathFilterParameterSpec(XPATH_SUBSET_V2, XPATH_SUBSET_NS_MAP);
    Transform transformXpath = signatureFactory.newTransform(Transform.XPATH, spec);
    transforms.add(transformXpath);
    transforms.add(excCanonicalization);

    return signatureFactory.newReference("", digestMethod, transforms, null, null);
}
