Loading XML2HTMLPlugin.php +33 −6 Changes for XML2HTMLPlugin.php: 33 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -61,7 +61,7 @@ class XML2HTMLPlugin extends GenericPlugin private function archiveView(string $filePath, int $submissionId, int $galleyId, string $op) { $htmlFile = XML2HTMLPlugin::getHTMLPathFromZipPath($filePath); $html = file_get_contents($htmlFile); $html = FALSE;//file_get_contents($htmlFile); //make transfo only if html does not exist if (!$html) { //get sources format from settings Loading Loading @@ -204,13 +204,28 @@ class XML2HTMLPlugin extends GenericPlugin ) { $xslFileName = strtolower($format) . '2html.xsl'; ////// xslt transfo $xsltPath = dirname(__FILE__) . DIRECTORY_SEPARATOR . $xslFileName; // Load the XML source $xsltDir= dirname(__FILE__) . DIRECTORY_SEPARATOR . 'xsl' . DIRECTORY_SEPARATOR . strtolower($format) . DIRECTORY_SEPARATOR; $result = NULL; foreach (glob($xsltDir . "*.xsl") as $xsltPath) { $xml = new DOMDocument; if($result == NULL){ // Load the XML source $xml->load($xmlFilePath); } else { //load previous xsl result $xml->loadXML($result); } $xsl = new DOMDocument; $xsl->load($xsltPath, LIBXML_DTDATTR); Loading @@ -218,9 +233,21 @@ class XML2HTMLPlugin extends GenericPlugin // Configure the transformer $proc = new XSLTProcessor; $proc->importStyleSheet($xsl); // attach the xsl rules //lang param $locale = AppLocale::getLocale(); $proc->setParameter('', 'lang', $locale); return $proc->transformToXML($xml); try { $result = $proc->transformToXML($xml); } catch(Exception $e) { $result = NULL; var_dump($e); } } return $result; } Loading tei2html.xsl +16 −12 Changes for tei2html.xsl: 16 added lines, 12 removed lines. Original line number Diff line number Diff line Loading @@ -14,8 +14,7 @@ <!--doctype-system="http://www.w3.org/TR/html4/loose.dtd"--> <!--encoding="UTF-8"/>--> <xsl:output method="html" encoding="UTF-8" indent="no"/> <xsl:output method="html" encoding="UTF-8" indent="no"/> <xsl:strip-space elements="*"/> Loading Loading @@ -330,7 +329,7 @@ <div class="ab-book-meta-field"> <!-- <node><xsl:copy-of select="current()"/></node>--> <xsl:if test="descendant::tei:dim[@type='pagination']/text() != ''"> <xsl:text>Pagination : </xsl:text> <xsl:text>Pagination : </xsl:text> <xsl:value-of select="descendant::tei:dim[@type='pagination']"/> </xsl:if> </div> Loading Loading @@ -418,7 +417,7 @@ <xsl:template match="tei:label[ancestor::tei:div[@type='index']]"> <xsl:apply-templates/> <xsl:if test="parent::tei:item[parent::tei:list[@type='level1']]"> <span class="toggle-button"> [+]</span> <span class="toggle-button"> [+]</span> </xsl:if> </xsl:template> Loading Loading @@ -530,7 +529,7 @@ <xsl:attribute name="onclick"> <xsl:value-of select='concat("openFigureWindow('",parent::tei:figure/@xml:id,"')")'/> </xsl:attribute> <xsl:text> ↗ </xsl:text> <xsl:text> ↗ </xsl:text> </a> </span> </label> Loading @@ -553,7 +552,7 @@ <xsl:attribute name="onclick"> <xsl:value-of select='concat("openFigureWindow('",parent::tei:figure/@xml:id,"')")'/> </xsl:attribute> <xsl:text> ↗ </xsl:text> <xsl:text> ↗ </xsl:text> </a> </span> </label> Loading Loading @@ -650,8 +649,13 @@ <!-- liste --> <xsl:template match="tei:list"> <xsl:variable name="listType" select="if( @type = 'ordered' ) then ( 'ol' ) else ( 'ul' )"/> <xsl:variable name="listType"> <xsl:choose> <xsl:when test="@type = 'ordered'">ol</xsl:when> <xsl:otherwise>ul</xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name="attributeValue" select="replace(@rendition, '^#?list-', 'list-style-type:')"/> <xsl:element name="{$listType}"> <xsl:attribute name="class" select="concat('index-',@type)"/> Loading Loading @@ -694,13 +698,13 @@ <xsl:choose> <xsl:when test="parent::tei:figure[@rend='inline']"> <span class="{@notation}"> <xsl:copy-of select="concat('$$',node(),'$$')"/> <!-- <xsl:copy-of select="concat('$$',node(),'$$')"/>--> </span> </xsl:when> <xsl:otherwise> <div class="formula-tex"> <xsl:copy-of select="@*"/> <xsl:copy-of select="concat('$$',node(),'$$')"/> <!-- <xsl:copy-of select="@*"/>--> <!-- <xsl:copy-of select="concat('$$',node(),'$$')"/>--> </div> </xsl:otherwise> </xsl:choose> Loading @@ -708,7 +712,7 @@ <xsl:template match="*[namespace-uri()='http://www.w3.org/1998/Math/MathML']"> <xsl:element name="{local-name()}"> <xsl:copy-of select="@* except(@display)"/> <!-- <xsl:copy-of select="@* except(@display)"/>--> <xsl:apply-templates select="node()"/> </xsl:element> </xsl:template> Loading jats2html.xsl→xsl/jats/jats2html.xsl +0 −0 File moved. View file Loading
XML2HTMLPlugin.php +33 −6 Changes for XML2HTMLPlugin.php: 33 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -61,7 +61,7 @@ class XML2HTMLPlugin extends GenericPlugin private function archiveView(string $filePath, int $submissionId, int $galleyId, string $op) { $htmlFile = XML2HTMLPlugin::getHTMLPathFromZipPath($filePath); $html = file_get_contents($htmlFile); $html = FALSE;//file_get_contents($htmlFile); //make transfo only if html does not exist if (!$html) { //get sources format from settings Loading Loading @@ -204,13 +204,28 @@ class XML2HTMLPlugin extends GenericPlugin ) { $xslFileName = strtolower($format) . '2html.xsl'; ////// xslt transfo $xsltPath = dirname(__FILE__) . DIRECTORY_SEPARATOR . $xslFileName; // Load the XML source $xsltDir= dirname(__FILE__) . DIRECTORY_SEPARATOR . 'xsl' . DIRECTORY_SEPARATOR . strtolower($format) . DIRECTORY_SEPARATOR; $result = NULL; foreach (glob($xsltDir . "*.xsl") as $xsltPath) { $xml = new DOMDocument; if($result == NULL){ // Load the XML source $xml->load($xmlFilePath); } else { //load previous xsl result $xml->loadXML($result); } $xsl = new DOMDocument; $xsl->load($xsltPath, LIBXML_DTDATTR); Loading @@ -218,9 +233,21 @@ class XML2HTMLPlugin extends GenericPlugin // Configure the transformer $proc = new XSLTProcessor; $proc->importStyleSheet($xsl); // attach the xsl rules //lang param $locale = AppLocale::getLocale(); $proc->setParameter('', 'lang', $locale); return $proc->transformToXML($xml); try { $result = $proc->transformToXML($xml); } catch(Exception $e) { $result = NULL; var_dump($e); } } return $result; } Loading
tei2html.xsl +16 −12 Changes for tei2html.xsl: 16 added lines, 12 removed lines. Original line number Diff line number Diff line Loading @@ -14,8 +14,7 @@ <!--doctype-system="http://www.w3.org/TR/html4/loose.dtd"--> <!--encoding="UTF-8"/>--> <xsl:output method="html" encoding="UTF-8" indent="no"/> <xsl:output method="html" encoding="UTF-8" indent="no"/> <xsl:strip-space elements="*"/> Loading Loading @@ -330,7 +329,7 @@ <div class="ab-book-meta-field"> <!-- <node><xsl:copy-of select="current()"/></node>--> <xsl:if test="descendant::tei:dim[@type='pagination']/text() != ''"> <xsl:text>Pagination : </xsl:text> <xsl:text>Pagination : </xsl:text> <xsl:value-of select="descendant::tei:dim[@type='pagination']"/> </xsl:if> </div> Loading Loading @@ -418,7 +417,7 @@ <xsl:template match="tei:label[ancestor::tei:div[@type='index']]"> <xsl:apply-templates/> <xsl:if test="parent::tei:item[parent::tei:list[@type='level1']]"> <span class="toggle-button"> [+]</span> <span class="toggle-button"> [+]</span> </xsl:if> </xsl:template> Loading Loading @@ -530,7 +529,7 @@ <xsl:attribute name="onclick"> <xsl:value-of select='concat("openFigureWindow('",parent::tei:figure/@xml:id,"')")'/> </xsl:attribute> <xsl:text> ↗ </xsl:text> <xsl:text> ↗ </xsl:text> </a> </span> </label> Loading @@ -553,7 +552,7 @@ <xsl:attribute name="onclick"> <xsl:value-of select='concat("openFigureWindow('",parent::tei:figure/@xml:id,"')")'/> </xsl:attribute> <xsl:text> ↗ </xsl:text> <xsl:text> ↗ </xsl:text> </a> </span> </label> Loading Loading @@ -650,8 +649,13 @@ <!-- liste --> <xsl:template match="tei:list"> <xsl:variable name="listType" select="if( @type = 'ordered' ) then ( 'ol' ) else ( 'ul' )"/> <xsl:variable name="listType"> <xsl:choose> <xsl:when test="@type = 'ordered'">ol</xsl:when> <xsl:otherwise>ul</xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name="attributeValue" select="replace(@rendition, '^#?list-', 'list-style-type:')"/> <xsl:element name="{$listType}"> <xsl:attribute name="class" select="concat('index-',@type)"/> Loading Loading @@ -694,13 +698,13 @@ <xsl:choose> <xsl:when test="parent::tei:figure[@rend='inline']"> <span class="{@notation}"> <xsl:copy-of select="concat('$$',node(),'$$')"/> <!-- <xsl:copy-of select="concat('$$',node(),'$$')"/>--> </span> </xsl:when> <xsl:otherwise> <div class="formula-tex"> <xsl:copy-of select="@*"/> <xsl:copy-of select="concat('$$',node(),'$$')"/> <!-- <xsl:copy-of select="@*"/>--> <!-- <xsl:copy-of select="concat('$$',node(),'$$')"/>--> </div> </xsl:otherwise> </xsl:choose> Loading @@ -708,7 +712,7 @@ <xsl:template match="*[namespace-uri()='http://www.w3.org/1998/Math/MathML']"> <xsl:element name="{local-name()}"> <xsl:copy-of select="@* except(@display)"/> <!-- <xsl:copy-of select="@* except(@display)"/>--> <xsl:apply-templates select="node()"/> </xsl:element> </xsl:template> Loading