elName = \strtolower($elName); } public function check(DOMElement $template, Tag $tag) { $xpath = new DOMXPath($template->ownerDocument); $query = '//*[translate(local-name(), "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz") = "' . $this->elName . '"]|//xsl:element[translate(@name,"ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz") = "' . $this->elName . '"]'; $node = $xpath->query($query)->item(0); if ($node) throw new UnsafeTemplateException("Element '" . $this->elName . "' is disallowed", $node); } }