/** * Compiles the XML attribute which may contain some dynamic data. * The method automatically recognizes the registered expression * engine and launches it. * * @param Opt_Xml_Attribute $attr The attribute to parse. */ public function compileAttribute(Opt_Xml_Attribute $attr) { $value = $attr->getValue(); if (preg_match('/^([a-zA-Z0-9\\_]+)\\:([^\\:].*)$/', $value, $found)) { switch ($found[1]) { case 'parse': $result = $this->parseExpression($found[2], $found[1], self::ESCAPE_ON, $this->_tpl->attributeModifier); $attr->addAfter(Opt_Xml_Buffer::ATTRIBUTE_VALUE, 'echo ' . $result['expression'] . '; '); break; case 'str': $result = $this->parseExpression($found[2], $found[1], self::ESCAPE_ON, $this->_tpl->attributeModifier); $attr->addAfter(Opt_Xml_Buffer::ATTRIBUTE_VALUE, 'echo ' . $result['escaped'] . '; '); break; case null: $attr->setValue($found[2]); break; } } }