diff --git a/src/XML/xenc11/AbstractAlgorithmIdentifierType.php b/src/XML/xenc11/AbstractAlgorithmIdentifierType.php
index edebbbfd..64cda62c 100644
--- a/src/XML/xenc11/AbstractAlgorithmIdentifierType.php
+++ b/src/XML/xenc11/AbstractAlgorithmIdentifierType.php
@@ -59,7 +59,11 @@ public function toXML(?DOMElement $parent = null): DOMElement
         $e = $this->instantiateParentElement($parent);
         $e->setAttribute('Algorithm', $this->getAlgorithm());
 
-        $this->getParameters()?->toXML($e);
+        if ($this->getParameters() !== null) {
+            if (!$this->getParameters()->isEmptyElement()) {
+                $this->getParameters()->toXML($e);
+            }
+        }
 
         return $e;
     }