Zend Framework And XML/XSLT Integration

new2you

New Member
I'm trying to use XML files and XSL stylesheets instead of ordinary phtml templates in Zend Framework. I'm not sure how to implement it, though.What I've tried to do so far:
  • instead of .phtml views I use .xsl stylesheets
  • I use .xml layouts
Here is what I do in the init() method of each controller:\[code\]$this->view->xmlStylesheet = '/../application/modules/default/views/scripts/'. $this->_request->getControllerName() . '/'. $this->_request->getActionName() . '.xsl';\[/code\]Which gives me a path like:\[code\]/../application/modules/default/views/scripts/index/index.xsl\[/code\]My layout looks like this:\[code\]<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="http://stackoverflow.com/questions/1894746/<?php echo $this->escape($this->xmlStylesheet); ?>"?><page> <header></header> <content></content> <footer></footer></page>\[/code\]And the views look like this for example:\[code\]<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml"> <xsl:eek:utput method="xml" indent="yes" omit-xml-declaration="yes" media-type="application/xhtml+xml" encoding="iso-8859-1" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/> <xsl:template match="/"> <html> <head> <title>Hello World</title> <meta http-equiv="content-type" content="application/xhtml+xml; charset=iso-8859-1"/> </head> <body> <xsl:apply-templates/> </body> </html> </xsl:template></xsl:stylesheet>\[/code\]What I get in the browser (Firefox) though is just a blank page with source like this, for instance:\[code\]<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="http://stackoverflow.com/application/modules/default/views/scripts/index/index.xsl"?><page> <header></header> <content></content> <footer></footer></page>\[/code\]Could somebody help me out? Take into consideration that I am an XML beginner so I'm just starting to learn how to use it effectively.
 
Top