source: main/trunk/greenstone3/web/interfaces/default/transform/pages/document-shared.xsl@ 37476

Last change on this file since 37476 was 36053, checked in by cstephen, 2 years ago

Document issue with documents that contain invalid HTML

File size: 2.4 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2
3<!--
4 Contains templates that are common to stylesheets
5 that deal with document-related transformations.
6-->
7
8<xsl:stylesheet version="1.0"
9 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
10 xmlns:java="http://xml.apache.org/xslt/java"
11 xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
12 xmlns:gslib="http://www.greenstone.org/skinning"
13 xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
14 extension-element-prefixes="java util"
15 exclude-result-prefixes="java util gsf">
16
17 <xsl:template name="sectionTitle">
18 <gsf:metadata name="Title" highlight="true" />
19 </xsl:template>
20
21 <xsl:template name="sectionHeading">
22 <xsl:call-template name="sectionTitle" />
23 </xsl:template>
24
25 <!-- Displays the text content of a node (content node or metadata node), marking up the annotations -->
26 <xsl:template name="displayMarkedUpTextAndAnnotations">
27 <xsl:variable name="annotation_class">
28 <xsl:choose>
29 <xsl:when test="/page/pageRequest/paramList/param[@name = 'hl']/@value = 'off' or /page/pageResponse/format[@type='display']/gsf:option[@name='disableSearchTermHighlighting']/@value='true'">
30 noTermHighlight
31 </xsl:when>
32 <xsl:otherwise>termHighlight</xsl:otherwise>
33 </xsl:choose>
34 </xsl:variable>
35
36 <xsl:for-each select="node()">
37 <xsl:choose>
38 <xsl:when test="not(name())">
39 <!--
40 TODO: Disabling output escaping can cause issues when the document content contains
41 invalid HTML, e.g. for PDF documents that have been converted.
42 In one case, the node title section contained a self-closing div, which is invalid.
43 This messes up the rest of the document structure.
44 -->
45 <xsl:value-of select="." disable-output-escaping="yes" />
46 </xsl:when>
47 <xsl:when test="name() = 'annotation'">
48 <span class="{$annotation_class}">
49 <xsl:value-of select="." />
50 </span>
51 </xsl:when>
52 <xsl:otherwise>
53 <xsl:apply-templates />
54 </xsl:otherwise>
55 </xsl:choose>
56 </xsl:for-each>
57 </xsl:template>
58
59</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.