Skip to content

Commit e944645

Browse files
authored
Merge pull request #612 from fsteimke/611-glossary-normalize-space
normalize space of text content as well as baseform for glossterm
2 parents 8447ce6 + 876b508 commit e944645

3 files changed

Lines changed: 43 additions & 3 deletions

File tree

src/main/xslt/modules/links.xsl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,13 @@
101101
</xsl:template>
102102

103103
<xsl:template match="db:firstterm|db:glossterm" mode="m:link">
104+
<xsl:variable name="baseform" as="xs:string" select="(@baseform,.)[1] => normalize-space()"/>
104105
<xsl:variable name="target"
105-
select="key('glossterm', (@baseform,normalize-space(.))[1])"/>
106+
select="key('glossterm', $baseform)"/>
106107

107108
<xsl:choose>
108109
<xsl:when test="empty($target)">
109-
<xsl:message select="'Gloss term has no entry:',
110-
(@baseform/string(), normalize-space(.))[1]"/>
110+
<xsl:message select="'Gloss term has no entry:',$baseform"/>
111111
<xsl:apply-templates/>
112112
</xsl:when>
113113
<xsl:otherwise>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" class="no-js"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><script>(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement)</script><title>glossary.012.xml</title><meta name="viewport" content="width=device-width, initial-scale=1.0"/><link href="https://purl.org/dc/elements/1.1/" rel="schema.dc"/><meta content="2011-04-22T17:02:00-06:00" name="dc.modified"/><meta content="DocBook xslTNG" name="generator"/><link href="./css/docbook.css" rel="stylesheet" media="screen"/></head><body class="home"><nav class="top"></nav><main><article class="book division"><header><h1>glossary.012.xml</h1><div class="abstract"><p>This tests glossterm where the term itself or its baseform contains spaces.</p></div></header><div class="list-of-titles"><div class="lot toc"><div class="title">Table of Contents</div><ul class="toc"><li><a href="#R_ch1"><span class="label">1</span><span class="sep"></span>Some title</a></li><li><a href="#R_g1">Glossary</a></li></ul></div></div><section id="R_ch1" class="chapter component"><header><h2>Chapter <span class="label">1</span><span class="sep"></span>Some title</h2></header><p>See the definition of <span class="glossterm"><a href="#R_g1_ge1">
2+
Cherry</a></span> in the glossary.</p><p>And see the definition of <span class="glossterm"><a href="#R_g1_ge1">cherry species</a></span> in the glossary.</p></section><div id="R_g1" class="auto component glossary"><header><h2>Glossary</h2></header><dl class="glossary"><dt id="R_g1_ge1" class="glossentry"><span class="glossterm">Cherry</span></dt><dd class="glossdef"><p>The most common cherry species in cultivation is sweet cherry (P.
3+
avium) to which most cherry cultivars belong. The sour cherry (P. cerasus)
4+
is also cultivated, mainly for cooking. Both species originate in Europe
5+
and western Asia; they usually do not cross-pollinate. In East Asia,
6+
Chinese cherry (P. pseudocerasus) and downy cherry (P. tomentosa) have
7+
been cultivated for thousands of years for their sweet fruits.</p></dd></dl></div></article></main><nav class="bottom"></nav></body></html>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<book xmlns="http://docbook.org/ns/docbook" version="5.0">
3+
<info>
4+
<title>glossary.012.xml</title>
5+
<abstract>
6+
<para>This tests glossterm where the term itself or its baseform contains spaces.</para>
7+
</abstract>
8+
</info>
9+
10+
<chapter>
11+
<title>Some title</title>
12+
13+
<para>See the definition of <glossterm>
14+
Cherry</glossterm> in the glossary.</para>
15+
<para>And see the definition of <glossterm baseform=" Cherry ">cherry species</glossterm> in the glossary.</para>
16+
</chapter>
17+
18+
<glossary role="auto">
19+
<title>Glossary</title>
20+
<glossentry>
21+
<glossterm>Cherry</glossterm>
22+
<glossdef>
23+
<para>The most common cherry species in cultivation is sweet cherry (P.
24+
avium) to which most cherry cultivars belong. The sour cherry (P. cerasus)
25+
is also cultivated, mainly for cooking. Both species originate in Europe
26+
and western Asia; they usually do not cross-pollinate. In East Asia,
27+
Chinese cherry (P. pseudocerasus) and downy cherry (P. tomentosa) have
28+
been cultivated for thousands of years for their sweet fruits.</para>
29+
</glossdef>
30+
</glossentry>
31+
</glossary>
32+
33+
</book>

0 commit comments

Comments
 (0)