Skip to content
This repository has been archived by the owner on Oct 13, 2022. It is now read-only.

Commit

Permalink
render() method on TeiDisplayText, untested.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmcclure committed Oct 22, 2012
1 parent 5c06961 commit 39f838d
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 6 deletions.
52 changes: 52 additions & 0 deletions models/TeiDisplayText.php
Expand Up @@ -59,4 +59,56 @@ public function getItem()
return $_itemsTable->find($this->item_id);
}

/**
* Get the parent file.
*
* @return File: The parent file.
*/
public function getFile()
{
$_filesTable = $this->getTable('File');
return $_filesTable->find($this->file_id);
}

/**
* Get the parent stylesheet.
*
* @return TeiDisplayStylesheet: The parent sheet.
*/
public function getSheet()
{
$_sheetsTable = $this->getTable('TeiDisplayStylesheet');
return $_sheetsTable->find($this->sheet_id);
}

/**
* Render XML->HTML.
*
* @return string The generated markup.
*/
public function render()
{

// Get tei and xslt.
$tei = $this->getFile();
$xsl = $this->getSheet();

// Create documents.
$teiDoc = new DOMDocument();
$xslDoc = new DOMDocument();

// Load content.
$teiDoc->load($tei->getWebPath('original'));
$xslDoc->loadXml($xsl->xslt);

// XSLT processor.
$proc = new XSLTProcessor();
$proc->importStylesheet($xslDoc);

// Render.
// return $proc->transformToXml($teiDoc);
return htmlspecialchars($xsl->xslt);

}

}
6 changes: 0 additions & 6 deletions tests/mocks/winters-tale.xml
Expand Up @@ -20,12 +20,6 @@
<idno type="ota">http://ota.ox.ac.uk/id/5729</idno>
<idno type="isbn10">1106027280</idno>
<idno type="isbn13">9781106027283</idno>






<availability status="restricted">
<licence target="http://creativecommons.org/licenses/by-sa/3.0/">
Distributed by the University of Oxford under a Creative Commons
Expand Down

0 comments on commit 39f838d

Please sign in to comment.