Mercurial > defr > templates
changeset 8:0b796d56c767
Suppression du pre-supposé selon lequel l'espace de template est prefixé t.
author | Franck Deroche <webmaster@defr.org> |
---|---|
date | Sun, 21 Oct 2007 14:18:09 +0200 |
parents | 61dee7e34a9d |
children | d06e9d5ff344 |
files | class.template.php |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/class.template.php Sun Oct 21 14:14:23 2007 +0200 +++ b/class.template.php Sun Oct 21 14:18:09 2007 +0200 @@ -10,6 +10,7 @@ $this->xmlDocument->validateOnParse = $shouldValidate; $this->xmlDocument->loadXML(file_get_contents($fileName)); $this->xmlXPath = new DOMXPath($this->xmlDocument); + $this->xmlXPath->registerNamespace('_t', Template::NS); } function apply($selector, $obj, DOMElement $root = null) { @@ -79,7 +80,7 @@ $selector = substr($selector, 0, $pos); } if($selector[0] == '#') { - $obj['xpath'] = "//*[@t:id='" . substr($selector, 1) . "']"; + $obj['xpath'] = "//*[@_t:id='" . substr($selector, 1) . "']"; $obj['nodes'] = $this->xmlXPath->query($obj['xpath'], $root); } else { @@ -140,7 +141,7 @@ function clean() { // Suppression des noeuds à cloner - $nodes = $this->xmlXPath->query("//*[@t:toClone]|//t:*"); + $nodes = $this->xmlXPath->query("//*[@_t:toClone]|//_t:*"); foreach($nodes as $node) { if($node->parentNode) { $node->parentNode->removeChild($node);