File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -565,13 +565,20 @@ export class SignedXml {
565565 for ( const idAttr of this . idAttributes ) {
566566 if ( typeof idAttr === "string" ) {
567567 if ( uri === elem . getAttribute ( idAttr ) ) {
568+ // We look for attributes in any namespace or no namespace
568569 ref . xpath = `//*[@*[local-name(.)='${ idAttr } ']='${ uri } ']` ;
569570 break ; // found the correct element, no need to check further
570571 }
571572 } else {
572573 const attr = utils . findAttr ( elem , idAttr . localName , idAttr . namespaceUri ) ;
573574 if ( attr && uri === attr . value ) {
574- ref . xpath = `//*[@*[local-name(.)='${ idAttr . localName } ' and namespace-uri(.)='${ idAttr . namespaceUri } ']='${ uri } ']` ;
575+ if ( idAttr . namespaceUri !== undefined ) {
576+ // When namespaceUri is set, we look for attributes in that specific namespace
577+ ref . xpath = `//*[@*[local-name(.)='${ idAttr . localName } ' and namespace-uri(.)='${ idAttr . namespaceUri } ']='${ uri } ']` ;
578+ } else {
579+ // When namespaceUri is explicitly set to undefined, we look only for attributes without a namespace
580+ ref . xpath = `//*[@*[local-name(.)='${ idAttr . localName } ' and namespace-uri(.)='']='${ uri } ']` ;
581+ }
575582 break ; // found the correct element, no need to check further
576583 }
577584 }
You can’t perform that action at this time.
0 commit comments