Discuss this help topic in SecureBlackbox Forum

XML: Add XPath transform to reference

TElXMLXPathTransform class represents the XPath transform for an XML digital signature as defined by the XML-DSig standard.

To add XPath transform to the reference transform chain you need to create instance of TElXMLXPathTransform class, set XPath expression, define prefixes used in expression and then add it to the chain.

C#:


TElXMLReference Ref = new TElXMLReference();
TElXMLXPathTransform XPathTransform = new TElXMLXPathTransform();
XPathTransform.NamespaceMap.AddNamespace("ds", "http://www.w3.org/2000/09/xmldsig#");
XPathTransform.XPath = "count(ancestor-or-self::ds:Signature) = 0";
Ref.TransformChain.Add(XPathTransform);
Delphi:

var Ref : TElXMLReference;
...
Ref := TElXMLReference.Create;
XPathTransform : TElXMLXPathTransform := TElXMLXPathTransform.Create();
XPathTransform.NamespaceMap.AddNamespace('ds', 'http://www.w3.org/2000/09/xmldsig#');
XPathTransform.XPath := 'count(ancestor-or-self::ds:Signature) = 0';
Ref.TransformChain.Add(XPathTransform);

How To articles about XML signing (XMLDSig and XAdES)

Discuss this help topic in SecureBlackbox Forum