{"id":166631,"date":"2013-01-22T15:16:03","date_gmt":"2013-01-22T11:16:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=166631"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=166631","title":{"rendered":"<span class=\"post_title\">Zend Framework: XSL \u0438 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f Views<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t\u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/www.contentwithstyle.co.uk\/content\/zend-framework-xsl-and-self-serializing-views\/\">Zend Framework: XSL and self-serializing Views<\/a><br \/>  \u0410\u0432\u0442\u043e\u0440: Pascal Opitz<\/p>\n<p>  \u042f \u0434\u0430\u0432\u043d\u043e \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u043b, \u0447\u0442\u043e \u0444\u0440\u0430\u0435\u043c\u0432\u043e\u0440\u043a\u0438 MVC \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0438\u043b\u0438 XSL \u0432\u043c\u0435\u0441\u0442\u043e \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0433\u043e PHP \u043a\u043e\u0434\u0430 \u0438 \u043f\u0440\u043e\u0447\u0435\u0433\u043e. \u0412\u043e\u0442 \u043f\u043e\u0447\u0435\u043c\u0443 \u044f \u043f\u043e\u0441\u0442\u0443\u0447\u0430\u043b \u0432\u043c\u0435\u0441\u0442\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0434\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438 Zend Framework, \u0433\u0434\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u0432\u0438\u0434\u0435 XSL \u0448\u0430\u0431\u043b\u043e\u043d\u0430, \u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0441\u0435\u0431\u044f \u0432 XML \u0434\u043b\u044f \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430.<\/p>\n<p>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u0411\u0430\u0437\u043e\u0432\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 MVC<\/h2>\n<p>  \u042f \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043b \u0434\u0435\u043c\u043e-\u043c\u0430\u043a\u0435\u0442, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 MVC \u0438\u0437 Zend_Controller:<\/p>\n<blockquote><p> |-application<br \/>   |&#8212;default<br \/>   |&#8212;&#8212;controllers<br \/>   |&#8212;&#8212;models<br \/>   |&#8212;&#8212;views<br \/>   |&#8212;&#8212;-filters<br \/>   |&#8212;&#8212;-helpers<br \/>   |&#8212;&#8212;-scripts<br \/>   |&#8212;&#8212;&#8212;index<br \/>   |&#8212;&#8212;&#8212;test<br \/>   |-library<br \/>   |&#8212;demo<br \/>   |&#8212;zendframework_1.6.2<br \/>   |-webroot  <\/p><\/blockquote>\n<p>  \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0437\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u044b\u0439 \u0444\u0430\u0439\u043b:<\/p>\n<pre><code class=\"php\">set_include_path('.'  . PATH_SEPARATOR . '..\/library\/zendframework_1.6.2\/'  . PATH_SEPARATOR . '..\/library\/demo\/'  . PATH_SEPARATOR . '..\/application\/default\/controllers'  . PATH_SEPARATOR . get_include_path());  require_once('Zend\/Loader.php'); Zend_Loader::loadClass('Zend_Controller_Front'); Zend_Loader::loadClass('Zend_Controller_Action_Helper_ViewRenderer');  $frontController = Zend_Controller_Front::getInstance(); $frontController-&gt;setControllerDirectory(array(  'default' =&gt; '..\/application\/default\/controllers', ));  require_once 'View_Xslt.php'; $view = new View_Xslt; $options = array(); $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer($view, $options); $viewRenderer-&gt;setViewSuffix('xsl'); Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);  $frontController-&gt;dispatch(); <\/code><\/pre>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043b \u043d\u043e\u0432\u044b\u0439 viewRenderer \u0438 \u0432\u0438\u0434 \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u0437 View_Xslt.php \u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043f\u0430\u043f\u043a\u0435 library\/demo. \u0422\u0430\u043a\u0436\u0435 \u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b \u0441\u0443\u0444\u0444\u0438\u043a\u0441 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043b\u044f XSL.<\/p>\n<p>  ZIP \u0444\u0430\u0439\u043b, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0432\u0441\u0435 \u0434\u0435\u043c\u043e (\u0431\u0435\u0437 \u0443\u0447\u0435\u0442\u0430 Zend Framework \u0444\u0430\u0439\u043b\u043e\u0432) \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c <a href=\"http:\/\/www.contentwithstyle.co.uk\/resources\/xslt_views_demo.zip\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<h4>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f (VIEW)<\/h4>\n<p>  View \u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d \u0438\u0437 \u043a\u043b\u0430\u0441\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u0442 Zend_View_Abstract. \u0420\u0435\u043d\u0434\u0438\u043d\u0433 View \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 _run, \u0438 \u0444\u0430\u0439\u043b \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430. \u041e\u0434\u043d\u0430\u043a\u043e, \u044d\u0442\u043e\u0442 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0441 func_get_arg, \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0435\u043c\u0441\u044f \u0441 \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u044b\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435, \u0447\u0442\u043e \u043d\u0430\u0448\u0435 \u0437\u0430\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0435\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e \u0441 Zend_View_Abstract.<\/p>\n<p>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0439 View \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u0430\u043c\u043e-\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u0437\u0436\u0435, \u044f \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043b Serializer \u0432 \u043c\u0430\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430, \u043f\u043b\u044e\u0441 \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432 XML \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Serializer, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043b\u0438.<\/p>\n<pre><code class=\"php\">require_once('Serializer.php');  class View_Xslt extends Zend_View_Abstract {  private $serializer;  private $rootName;    public function __construct($data = array()) {  $this-&gt;serializer = new Serializer();  parent::__construct($data);  }   public function setRootName($name) {  $this-&gt;rootName = $name;  }    protected function _run() {  $template = func_get_arg(0);   $xslDoc = new DOMDocument();  $xslDoc-&gt;load($template);  $xmlDoc = $this-&gt;toXml();  $proc = new XSLTProcessor();  $proc-&gt;importStylesheet($xslDoc);  echo $proc-&gt;transformToXML($xmlDoc);  }    private function toXml() {  $xml_str = $this-&gt;serializer-&gt;Serialize($this, $this-&gt;rootName);  return $xml_str;  } } <\/code><\/pre>\n<h4>\u0421\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 (Serializer)<\/h4>\n<p>  \u0422\u0430\u043a \u0447\u0442\u043e \u0436\u0435 \u044d\u0442\u043e \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0434\u0435\u043b\u0430\u0435\u0442? \u041e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u041e\u0442\u0440\u0430\u0436\u0435\u043d\u0438\u0435(<a href=\"http:\/\/ru.wikipedia.org\/wiki\/Reflection\">\u0440\u0435\u0444\u043b\u0435\u043a\u0441\u0438\u044e<\/a>) \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 XML \u0441\u0442\u0440\u043e\u043a\u0443. \u042d\u0442\u043e \u0434\u0430\u0435\u0442 \u043d\u0430\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0430\u0448\u0438\u0445 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439(controller actions), \u043f\u0440\u043e\u0441\u0442\u043e \u0433\u043e\u0432\u043e\u0440\u044f $this-&gt;foo = &#8216;b\u0430\u0440&#8217;.<\/p>\n<p>  \u042f \u0434\u0435\u043b\u0430\u043b \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u043f\u043e\u0441\u0442 XML-\u0421\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0440\u0430\u043d\u044c\u0448\u0435, \u0438 \u0421\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043b \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u043b\u0435\u043d, \u0447\u0442\u043e \u044f \u043d\u0430\u0448\u0435\u043b \u0442\u0430\u043c. \u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0435\u0440\u0435\u0436\u0435\u043d\u0438\u0435: \u0418\u043c\u0435\u0439\u0442\u0435 \u0432 \u0432\u0438\u0434\u0443, \u0447\u0442\u043e \u044d\u0442\u043e \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u0434\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438, \u0438 \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043b\u0443\u0447\u0448\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<pre><code class=\"php\">class Serializer {  private $xmlDoc;    public function __construct() {  $this-&gt;xmlDoc = new DOMDocument();  }    public function Serialize($inst, $nodeName=null) {  if(is_object($inst))  {   $nodeName = ($nodeName == null) ? get_class($inst) : $nodeName;   $root = $this-&gt;xmlDoc-&gt;createElement($nodeName);   $this-&gt;xmlDoc-&gt;appendChild($root);   $this-&gt;SerializeObject($inst, $nodeName, $root);  } else if(is_array($inst)) {   $nodeName = ($nodeName == null) ? get_class($inst) : $nodeName;   $root = $this-&gt;xmlDoc-&gt;createElement($nodeName);   $this-&gt;xmlDoc-&gt;appendChild($root);   $this-&gt;SerializeArray($inst, $nodeName, $root);  }   return $this-&gt;xmlDoc;  }    private function SerializeObject($inst, $nodeName, $parent) {  $obj = new ReflectionObject($inst);  $properties = $obj-&gt;getProperties();    foreach($properties as $prop) {   if(!$prop-&gt;isPrivate()) {   $elem = $this-&gt;SerializeData($prop-&gt;getName(), $prop-&gt;getValue($inst), $parent);   }  }  }    private function SerializeArray($array, $nodeName, $parent) {  foreach($array as $key =&gt; $val) {   $keyStr = (is_numeric($key)) ? 'ArrayValue' : $key;   $elem = $this-&gt;SerializeData($keyStr, $val, $parent);      if(is_numeric($key)) {   $elem-&gt;setAttribute('index', $key);   }  }  }    private function SerializeData($key, $val, $parent) {  if(is_object($val)) {   $propNodeName = get_class($val);   $elem = $this-&gt;xmlDoc-&gt;createElement($propNodeName);   $parent-&gt;appendChild($elem);      $this-&gt;SerializeObject($val, $propNodeName, $parent);   $elem-&gt;setAttribute('type', 'object');  } else if(is_array($val)) {   $elem = $this-&gt;xmlDoc-&gt;createElement($key);   $parent-&gt;appendChild($elem);   $this-&gt;SerializeArray($val, $key, $elem);   $elem-&gt;setAttribute('type', 'array');  } else {   $elem = $this-&gt;xmlDoc-&gt;createElement($key, $val);   $parent-&gt;appendChild($elem);   $elem-&gt;setAttribute('type', 'property');  }    return $elem;  } } <\/code><\/pre>\n<h4>\u0424\u0430\u0439\u043b\u044b \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u0435\u0440\u0430 \u0438 \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f<\/h4>\n<p>  \u041f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435. \u041d\u0430\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u0430\u0439\u043b\u043e\u0432 XSL \u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0441 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u043c\u0438, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0435\u0435 \u0434\u0435\u043c\u043e. \u041f\u0435\u0440\u0432\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435. \u042f \u0432\u043a\u043b\u044e\u0447\u0438\u043b \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 \u0434\u0435\u043c\u043e \u043a\u043b\u0430\u0441\u0441, \u0447\u0442\u043e\u0431 \u043c\u044b \u0441\u043c\u043e\u0433\u043b\u0438 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438:<\/p>\n<pre><code class=\"php\">class IndexController extends Zend_Controller_Action {  public function indexAction() {   $this-&gt;view-&gt;setRootName('DataObject');    $this-&gt;view-&gt;foo = 'bar';   $this-&gt;view-&gt;super = array(   'here' =&gt; 'there', 'foo' =&gt; array(1,2,'test'),   );   $this-&gt;view-&gt;testObject = new DemoObject();   $this-&gt;view-&gt;testObject-&gt;var = 'testObjectVar';  } }  class DemoObject {} <\/code><\/pre>\n<p>  \u0424\u0430\u0439\u043b(\u044b) View. \u041c\u044b \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d, \u043d\u043e \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u044f \u0445\u043e\u0442\u0435\u043b \u043f\u043e\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c Zend_Layout, \u044f \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b xsl: import \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u0447\u0442\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435.<\/p>\n<pre><code class=\"xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot;?&gt; &lt;xsl:stylesheet version=&quot;1.0&quot; xmlns:xsl=&quot;http:\/\/www.w3.org\/1999\/XSL\/Transform&quot;&gt;  &lt;xsl:import href=&quot;..\/layout.xsl&quot;\/&gt;   &lt;xsl:template match=&quot;DataObject&quot;&gt;  &lt;xsl:apply-templates select=&quot;*&quot; \/&gt;  &lt;\/xsl:template&gt;    &lt;xsl:template match=&quot;*&quot;&gt;  &lt;div&gt;   &lt;h2&gt;&lt;xsl:value-of select=&quot;name()&quot; \/&gt;&lt;\/h2&gt;   &lt;xsl:apply-templates select=&quot;text()&quot; \/&gt;   &lt;xsl:apply-templates select=&quot;*&quot; \/&gt;  &lt;\/div&gt;   &lt;\/xsl:template&gt; &lt;\/xsl:stylesheet&gt; <\/code><\/pre>\n<pre><code class=\"xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot;?&gt; &lt;xsl:stylesheet version=&quot;1.0&quot; xmlns:xsl=&quot;http:\/\/www.w3.org\/1999\/XSL\/Transform&quot;&gt;  &lt;xsl:output method=&quot;xml&quot; encoding=&quot;ISO-8859-1&quot; omit-xml-declaration=&quot;no&quot; doctype-public=&quot;-\/\/W3C\/\/DTD XHTML 1.0 Transitional\/\/EN&quot; doctype-system=&quot;http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-transitional.dtd&quot; indent=&quot;yes&quot; \/&gt;  &lt;xsl:template match=&quot;\/&quot;&gt;  &lt;html&gt;   &lt;head&gt;   &lt;title&gt;Test&lt;\/title&gt;   &lt;\/head&gt;      &lt;body&gt;   &lt;xsl:apply-templates select=&quot;\/*&quot; \/&gt;   &lt;\/body&gt;  &lt;\/html&gt;  &lt;\/xsl:template&gt; &lt;\/xsl:stylesheet&gt; <\/code><\/pre>\n<h4>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/h4>\n<p>  \u0418 \u0432\u043e\u0442 \u043e\u043d\u043e \u0447\u0442\u043e! \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0434\u0430\u0442\u044c \u0432\u0430\u043c \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435 \u044d\u0442\u043e\u0433\u043e:<\/p>\n<pre><code class=\"html\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot;?&gt; &lt;!DOCTYPE html PUBLIC &quot;-\/\/W3C\/\/DTD XHTML 1.0 Transitional\/\/EN&quot; &quot;http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-transitional.dtd&quot;&gt; &lt;html xmlns=&quot;http:\/\/www.w3.org\/1999\/xhtml&quot;&gt;  &lt;head&gt;  &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text\/html; charset=ISO-8859-1&quot; \/&gt;  &lt;title&gt;Test&lt;\/title&gt;  &lt;\/head&gt;  &lt;body&gt;  &lt;div&gt;&lt;h2&gt;foo&lt;\/h2&gt;bar&lt;\/div&gt;   &lt;div&gt;  &lt;h2&gt;super&lt;\/h2&gt;  &lt;div&gt;&lt;h2&gt;here&lt;\/h2&gt;there&lt;\/div&gt;  &lt;div&gt;  &lt;h2&gt;foo&lt;\/h2&gt;  &lt;div&gt;&lt;h2&gt;ArrayValue&lt;\/h2&gt;1&lt;\/div&gt;   &lt;div&gt;&lt;h2&gt;ArrayValue&lt;\/h2&gt;2&lt;\/div&gt;  &lt;div&gt;&lt;h2&gt;ArrayValue&lt;\/h2&gt;test&lt;\/div&gt;  &lt;\/div&gt;  &lt;\/div&gt;  &lt;div&gt;  &lt;h2&gt;DemoObject&lt;\/h2&gt;   &lt;\/div&gt;  &lt;div&gt;&lt;h2&gt;var&lt;\/h2&gt;testObjectVar&lt;\/div&gt;  &lt;\/body&gt; &lt;\/html&gt; <\/code><\/pre>\n<hr\/>\n<p>  \u0422\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u044f \u0434\u043e\u043b\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0441 XML \u0438 \u043c\u043d\u0435 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440 \u0438\u0437 XSLT \u0432 ZendFramework, \u0438 \u044d\u0442\u043e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u043e\u0435 \u0436\u0435\u043b\u0430\u043d\u0438\u0435.<\/p>\n<p>  \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430, \u0433\u0434\u0435 \u0434\u0432\u0438\u0436\u043e\u043a \u0438 \u043d\u0430\u0431\u043e\u0440 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u0434\u043b\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0441\u0430\u0439\u0442\u043e\u0432 \u0432\u0438\u0437\u0438\u0442\u043e\u043a, \u0430 \u043a\u043e\u043d\u0442\u0435\u043d\u0442 \u043e\u0442 \u043d\u0438\u0445 \u0445\u0440\u0430\u043d\u0438\u043b\u0441\u044f \u0432 \u0444\u0430\u0439\u043b\u0430\u0445 xml \u043f\u0430\u043f\u043a\u0435 data. \u0418 \u0432\u0441\u044f \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f \u0441 \u0445\u043e\u0441\u0442\u0438\u043d\u0433\u0430 \u043d\u0430 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u043b\u0430 \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c, \u0431\u0435\u0437 \u0433\u043e\u043b\u043e\u0432\u043d\u043e\u0439 \u0431\u043e\u043b\u0438 \u0441 \u0411\u0414. \u0410 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043f\u0430\u043f\u043a\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043b\u0430 \u0442\u043e\u043b\u044c\u043a\u043e CSS, JavaScript \u0438 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438.   \t\t\t \t\t\t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/166631\/\"> http:\/\/habrahabr.ru\/post\/166631\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t\u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/www.contentwithstyle.co.uk\/content\/zend-framework-xsl-and-self-serializing-views\/\">Zend Framework: XSL and self-serializing Views<\/a><br \/>  \u0410\u0432\u0442\u043e\u0440: Pascal Opitz<\/p>\n<p>  \u042f \u0434\u0430\u0432\u043d\u043e \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u043b, \u0447\u0442\u043e \u0444\u0440\u0430\u0435\u043c\u0432\u043e\u0440\u043a\u0438 MVC \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0438\u043b\u0438 XSL \u0432\u043c\u0435\u0441\u0442\u043e \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0433\u043e PHP \u043a\u043e\u0434\u0430 \u0438 \u043f\u0440\u043e\u0447\u0435\u0433\u043e. \u0412\u043e\u0442 \u043f\u043e\u0447\u0435\u043c\u0443 \u044f \u043f\u043e\u0441\u0442\u0443\u0447\u0430\u043b \u0432\u043c\u0435\u0441\u0442\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0434\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438 Zend Framework, \u0433\u0434\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u0432\u0438\u0434\u0435 XSL \u0448\u0430\u0431\u043b\u043e\u043d\u0430, \u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0441\u0435\u0431\u044f \u0432 XML \u0434\u043b\u044f \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-166631","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/166631","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=166631"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/166631\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=166631"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=166631"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=166631"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}