code: func (ctx *ValidationContext) transform(
  	el *etree.Element,
  	sig *types.Signature,
  	ref *types.Reference) (*etree.Element, Canonicalizer, error) {
  	transforms := ref.Transforms.Transforms
  
  	if len(transforms) != 2 {
  		return nil, nil, errors.New("Expected Enveloped and C14N transforms")
  	}
  
  	// map the path to the passed signature relative to the passed root, in
  	// order to enable removal of the signature by an enveloped signature
  	// transform
  	signaturePath := mapPathToElement(el, sig.UnderlyingElement())
  
  	// make a copy of the passed root
  	el = el.Copy()
  
  	var canonicalizer Canonicalizer
  
  	for _, transform := range transforms {
  		algo := transform.Algorithm
  
  		switch AlgorithmID(algo) {
  		case EnvelopedSignatureAltorithmId:
  			if !removeElementAtPath(el, signaturePath) {
  				return nil, nil, errors.New("Error applying canonicalization transform: Signature not found")
  			}
  
  		case CanonicalXML10ExclusiveAlgorithmId:
  			var prefixList string
  			if transform.InclusiveNamespaces != nil {
  				prefixList = transform.InclusiveNamespaces.PrefixList
  			}
  
  			canonicalizer = MakeC14N10ExclusiveCanonicalizerWithPrefixList(prefixList)
  
  		case CanonicalXML11AlgorithmId:
  			canonicalizer = MakeC14N11Canonicalizer()
  
  		case CanonicalXML10RecAlgorithmId:
  			canonicalizer = MakeC14N10RecCanonicalizer()
  
  		case CanonicalXML10CommentAlgorithmId:
  			canonicalizer = MakeC14N10CommentCanonicalizer()
  
  		default:
  			return nil, nil, errors.New("Unknown Transform Algorithm: " + algo)
  		}
  	}
  
  	if canonicalizer == nil {
  		return nil, nil, errors.New("Expected canonicalization transform")
  	}
  
  	return el, canonicalizer, nil
  }
docs: // Transform returns a new element equivalent to the passed root el, but with
  // the set of transformations described by the ref applied.
  //
  // The functionality of transform is currently very limited and purpose-specific.