Mercurial > hg > mpdl-group
comparison software/eXist/webapp/mpdl/presentation/pageHtml.xsl @ 15:e99964f390e4
diverse Fehlerbehebungen
author | Josef Willenborg <jwillenborg@mpiwg-berlin.mpg.de> |
---|---|
date | Mon, 29 Aug 2011 17:40:19 +0200 |
parents | 469d927b9ca7 |
children | 7e883ce72fec |
comparison
equal
deleted
inserted
replaced
14:5df60f24e997 | 15:e99964f390e4 |
---|---|
4 xmlns:xlink="http://www.w3.org/1999/xlink" | 4 xmlns:xlink="http://www.w3.org/1999/xlink" |
5 xmlns:xs="http://www.w3.org/2001/XMLSchema" | 5 xmlns:xs="http://www.w3.org/2001/XMLSchema" |
6 xmlns:functx="http://www.functx.com" | 6 xmlns:functx="http://www.functx.com" |
7 xmlns:saxon="http://saxon.sf.net/" | 7 xmlns:saxon="http://saxon.sf.net/" |
8 xmlns:mpdl="http://www.mpiwg-berlin.mpg.de/ns/mpdl" | 8 xmlns:mpdl="http://www.mpiwg-berlin.mpg.de/ns/mpdl" |
9 xmlns:mpdl-util="http://www.mpiwg-berlin.mpg.de/ns/mpdl/util" | |
9 xmlns:text="http://www.mpiwg-berlin.mpg.de/ns/mpdl/text" | 10 xmlns:text="http://www.mpiwg-berlin.mpg.de/ns/mpdl/text" |
10 xmlns:mpdl-util="http://www.mpiwg-berlin.mpg.de/ns/mpdl/util" | |
11 xmlns:dc="http://purl.org/dc/elements/1.1/" | 11 xmlns:dc="http://purl.org/dc/elements/1.1/" |
12 xmlns:dcterms="http://purl.org/dc/terms" | 12 xmlns:dcterms="http://purl.org/dc/terms" |
13 xmlns:echo="http://www.mpiwg-berlin.mpg.de/ns/echo/1.0/" | 13 xmlns:echo="http://www.mpiwg-berlin.mpg.de/ns/echo/1.0/" |
14 xmlns:math="http://www.w3.org/1998/Math/MathML" | 14 xmlns:math="http://www.w3.org/1998/Math/MathML" |
15 xmlns:svg="http://www.w3.org/2000/svg" | 15 xmlns:svg="http://www.w3.org/2000/svg" |
16 xmlns:xhtml="http://www.w3.org/1999/xhtml"> | 16 xmlns:xhtml="http://www.w3.org/1999/xhtml"> |
17 | 17 |
18 <xsl:import href="/db/mpdl/presentation/functions-mpdl.xsl" /> | 18 <xsl:import href="/db/mpdl/presentation/functions-mpdl.xsl" /> |
19 <xsl:import href="/db/mpdl/presentation/functions-text.xsl" /> | 19 <xsl:import href="/db/mpdl/presentation/functions-text.xsl" /> |
20 <xsl:import href="/db/mpdl/presentation/functions-util.xsl" /> | 20 <xsl:import href="/db/mpdl/presentation/functions-util.xsl" /> |
21 | |
22 <xsl:strip-space elements="*"/> | |
21 | 23 |
22 <xsl:output method="xhtml" encoding="utf-8"/> | 24 <xsl:output method="xhtml" encoding="utf-8"/> |
23 | 25 |
24 <xsl:variable name="errorMessage" select="string(/result/query/result/error)"/> | 26 <xsl:variable name="errorMessage" select="string(/result/query/result/error)"/> |
25 <xsl:variable name="mode" select="/result/page/mode"/> | 27 <xsl:variable name="mode" select="/result/page/mode"/> |
27 <xsl:variable name="query" select="text:trim(string(/result/query/expression))"/> | 29 <xsl:variable name="query" select="text:trim(string(/result/query/expression))"/> |
28 <xsl:variable name="queryResultPages" select="number(/result/query/result/pages)"/> | 30 <xsl:variable name="queryResultPages" select="number(/result/query/result/pages)"/> |
29 <xsl:variable name="queryResultPN" select="/result/query/result/pn"/> | 31 <xsl:variable name="queryResultPN" select="/result/query/result/pn"/> |
30 <xsl:variable name="language" select="/result/document-description/language"/> | 32 <xsl:variable name="language" select="/result/document-description/language"/> |
31 <xsl:variable name="sn" select="number(/result/page/sentence-number)"/> | 33 <xsl:variable name="sn" select="number(/result/page/sentence-number)"/> |
34 <xsl:variable name="highlightElement" select="/result/page/highlightElement"/> | |
35 <xsl:variable name="highlightElementPos" select="number(/result/page/highlightElementPos)"/> | |
32 <xsl:variable name="digilibAvailable" select="/result/page/digilib-available"/> | 36 <xsl:variable name="digilibAvailable" select="/result/page/digilib-available"/> |
33 <xsl:variable name="options" select="/result/page/options"/> | 37 <xsl:variable name="options" select="/result/page/options"/> |
34 <xsl:variable name="topPB" select="subsequence(//pb, 1, 1)"/> | 38 <xsl:variable name="topPB" select="subsequence(//pb, 1, 1)"/> |
35 <xsl:variable name="firstSentence" select="subsequence(//s, 1, 1)"/> | 39 <xsl:variable name="firstSentence" select="subsequence(//s, 1, 1)"/> |
36 <xsl:variable name="ftQueryTermsTemp" select="string-join(text:translateLuceneToTerms($query), '')" as="xs:string"/> | 40 <xsl:variable name="ftQueryTermsTemp" select="string-join(text:translateLuceneToTerms($query), '')" as="xs:string"/> |
137 <xsl:when test="$mode = 'xml'"><button id="buttonModeXml" name="mode" value="xml" style="background:none;border:none;"><img src="images/xml.jpg" height="18"/></button></xsl:when> | 141 <xsl:when test="$mode = 'xml'"><button id="buttonModeXml" name="mode" value="xml" style="background:none;border:none;"><img src="images/xml.jpg" height="18"/></button></xsl:when> |
138 <xsl:otherwise><button id="buttonModeUXml" name="mode" value="xml" style="background:none;border:none;"><img src="images/xmlU.jpg" height="18"/></button></xsl:otherwise> | 142 <xsl:otherwise><button id="buttonModeUXml" name="mode" value="xml" style="background:none;border:none;"><img src="images/xmlU.jpg" height="18"/></button></xsl:otherwise> |
139 </xsl:choose> | 143 </xsl:choose> |
140 </td> | 144 </td> |
141 <input type="hidden" name="pn" value="{$pageNumber}"/> | 145 <input type="hidden" name="pn" value="{$pageNumber}"/> |
142 <xsl:if test="/result/page/sentence-number[node()]"> | 146 <xsl:if test="/result/page/highlightElement[node()]"> |
143 <input type="hidden" name="sn" value="{$sn}"/> | 147 <input type="hidden" name="highlightElement" value="{$highlightElement}"/> |
148 </xsl:if> | |
149 <xsl:if test="/result/page/highlightElementPos[node()]"> | |
150 <input type="hidden" name="highlightElementPos" value="{$highlightElementPos}"/> | |
144 </xsl:if> | 151 </xsl:if> |
145 <input type="hidden" name="query-type" value="{$queryType}"/> | 152 <input type="hidden" name="query-type" value="{$queryType}"/> |
146 <xsl:if test="/result/query/result[node()]"> | 153 <xsl:if test="/result/query/result[node()]"> |
147 <input type="hidden" name="query" value="{$query}"/> | 154 <input type="hidden" name="query" value="{$query}"/> |
148 <input type="hidden" name="query-result-pn" value="{$queryResultPN}"/> | 155 <input type="hidden" name="query-result-pn" value="{$queryResultPN}"/> |
152 <!-- toc, fulltext, fulltextMorph, structural, ftIndex and ftIndexMorph buttons --> | 159 <!-- toc, fulltext, fulltextMorph, structural, ftIndex and ftIndexMorph buttons --> |
153 <form action="page-query-result.xql" method="get"> | 160 <form action="page-query-result.xql" method="get"> |
154 <input type="hidden" name="document" value="{$documentUri}"/> | 161 <input type="hidden" name="document" value="{$documentUri}"/> |
155 <input type="hidden" name="mode" value="{$mode}"/> | 162 <input type="hidden" name="mode" value="{$mode}"/> |
156 <input type="hidden" name="pn" value="{$pageNumber}"/> | 163 <input type="hidden" name="pn" value="{$pageNumber}"/> |
157 <xsl:if test="/result/page/sentence-number[node()]"> | |
158 <input type="hidden" name="sn" value="-1"/> | |
159 </xsl:if> | |
160 <td><button id="bToc" name="query-type" value="toc" style="background: none; border: none;"><img src="images/toc.gif" width="24" height="24"/></button></td> | 164 <td><button id="bToc" name="query-type" value="toc" style="background: none; border: none;"><img src="images/toc.gif" width="24" height="24"/></button></td> |
161 <td><button id="bFulltext" name="query-type" value="fulltext" style="background: none; border: none;"><img src="images/search.gif" width="24" height="24"/></button></td> | 165 <td><button id="bFulltext" name="query-type" value="fulltext" style="background: none; border: none;"><img src="images/search.gif" width="24" height="24"/></button></td> |
162 <td><button id="bFulltextMorph" name="query-type" value="fulltextMorph" style="background: none; border: none;"><img src="images/searchMorph.gif" width="24" height="24"/></button></td> | 166 <td><button id="bFulltextMorph" name="query-type" value="fulltextMorph" style="background: none; border: none;"><img src="images/searchMorph.gif" width="24" height="24"/></button></td> |
163 <td><button id="bStructural" name="query-type" value="xpath" style="background: none; border: none;"><img src="images/searchStructural.gif" width="24" height="24"/></button></td> | 167 <td><button id="bStructural" name="query-type" value="xpath" style="background: none; border: none;"><img src="images/searchStructural.gif" width="24" height="24"/></button></td> |
164 <td><button id="bFtIndex" name="query-type" value="ftIndex" style="background: none; border: none;"><img src="images/dictionary.gif" width="24" height="24"/></button></td> | 168 <td><button id="bFtIndex" name="query-type" value="ftIndex" style="background: none; border: none;"><img src="images/dictionary.gif" width="24" height="24"/></button></td> |
426 </colgroup> | 430 </colgroup> |
427 <tr> | 431 <tr> |
428 <td> | 432 <td> |
429 <xsl:variable name="resultSize" select="/result/query/result/size"/> | 433 <xsl:variable name="resultSize" select="/result/query/result/size"/> |
430 <xsl:if test="$queryType = 'fulltext' or $queryType = 'fulltextMorph' or $queryType = 'fulltextMorphLemma'"> | 434 <xsl:if test="$queryType = 'fulltext' or $queryType = 'fulltextMorph' or $queryType = 'fulltextMorphLemma'"> |
431 <b><xsl:value-of select="$resultSize"/> sentence hits</b> | 435 <b><xsl:value-of select="$resultSize"/> hits</b> |
432 </xsl:if> | 436 </xsl:if> |
433 <xsl:if test="$queryType = 'ftIndex' or $queryType = 'ftIndexMorph'"> | 437 <xsl:if test="$queryType = 'ftIndex' or $queryType = 'ftIndexMorph'"> |
434 <b><xsl:value-of select="$resultSize"/> entries beginning with: "<xsl:value-of select="$query"/>"<br/></b> | 438 <b><xsl:value-of select="$resultSize"/> entries beginning with: "<xsl:value-of select="$query"/>"<br/></b> |
435 </xsl:if> | 439 </xsl:if> |
436 <xsl:if test="$queryType = 'xpath' or $queryType = 'xquery'"> | 440 <xsl:if test="$queryType = 'xpath' or $queryType = 'xquery'"> |
531 <tr valign="top"> | 535 <tr valign="top"> |
532 <xsl:variable name="pos" select="pos"/> | 536 <xsl:variable name="pos" select="pos"/> |
533 <xsl:variable name="term" select="term"/> | 537 <xsl:variable name="term" select="term"/> |
534 <td><xsl:value-of select="$pos"/>.</td> | 538 <td><xsl:value-of select="$pos"/>.</td> |
535 <td align="left"> | 539 <td align="left"> |
540 <xsl:variable name="hitType" select="hitType"/> | |
536 <xsl:variable name="hitPN" select="pn"/> | 541 <xsl:variable name="hitPN" select="pn"/> |
537 <xsl:variable name="hitPosOfS" select="pos-of-s"/> | 542 <xsl:variable name="hitString" select="hitString"/> |
538 <xsl:variable name="sSurroundsPB" select="s-surrounds-pb"/> | 543 <xsl:variable name="hitPos" select="hitPos"/> |
544 <xsl:variable name="hitSurroundsPB" select="hitSurroundsPB"/> | |
539 <xsl:variable name="queryValue" select="concat('&', 'query=', $query)"/> | 545 <xsl:variable name="queryValue" select="concat('&', 'query=', $query)"/> |
540 <xsl:variable name="queryValueEscaped1" select="replace($queryValue, '\+', '%2B')"/> | 546 <xsl:variable name="queryValueEscaped1" select="replace($queryValue, '\+', '%2B')"/> |
541 <xsl:variable name="queryValueEscaped2" select="replace($queryValueEscaped1, ' ', '+')"/> | 547 <xsl:variable name="queryValueEscaped2" select="replace($queryValueEscaped1, ' ', '+')"/> |
542 <xsl:choose> | 548 <xsl:choose> |
543 <!-- if a found sentence surrounds a page break then a special presentation of the hit is done --> | 549 <!-- if a found sentence surrounds a page break then a special presentation of the hit is done --> |
544 <xsl:when test="$sSurroundsPB = 'false'"> | 550 <xsl:when test="$hitType = 's' and $hitSurroundsPB = 'false'"> |
545 <a href="?{$documentValue}&pn={$hitPN}&sn={$hitPosOfS}&{$modeValue}&query-type={$queryType}{$queryValueEscaped2}&query-result-pn={$queryResultPN}#sn{$hitPosOfS}">Page <xsl:value-of select="$hitPN"/>, Sentence <xsl:value-of select="$hitPosOfS"/></a> | 551 <a href="?{$documentValue}&pn={$hitPN}&{$modeValue}&query-type={$queryType}{$queryValueEscaped2}&query-result-pn={$queryResultPN}&highlightElement={$hitType}&highlightElementPos={$hitPos}#s{$hitPos}">Page <xsl:value-of select="$hitPN"/>, Sentence <xsl:value-of select="$hitPos"/></a> |
552 </xsl:when> | |
553 <xsl:when test="$hitType = 'head'"> | |
554 <a href="?{$documentValue}&pn={$hitPN}&{$modeValue}&query-type={$queryType}{$queryValueEscaped2}&query-result-pn={$queryResultPN}&highlightElement={$hitType}&highlightElementPos={$hitPos}#head{$hitPos}">Page <xsl:value-of select="$hitPN"/>, Head <xsl:value-of select="$hitPos"/></a> | |
546 </xsl:when> | 555 </xsl:when> |
547 <xsl:otherwise> | 556 <xsl:otherwise> |
548 <a href="?{$documentValue}&pn={$hitPN}&sn={$hitPosOfS}&{$modeValue}&query-type={$queryType}{$queryValueEscaped2}&query-result-pn={$queryResultPN}#sn{$hitPosOfS}">Page <xsl:value-of select="$hitPN"/>, Sentence <xsl:value-of select="$hitPosOfS"/></a> / <a href="?{$documentValue}&pn={$hitPN + 1}&sn=0&{$modeValue}&query-type={$queryType}{$queryValueEscaped2}&query-result-pn={$queryResultPN}#sn0">Page <xsl:value-of select="$hitPN + 1"/>, continuation of the sentence</a> | 557 <a href="?{$documentValue}&pn={$hitPN}&{$modeValue}&query-type={$queryType}{$queryValueEscaped2}&query-result-pn={$queryResultPN}&highlightElement={$hitType}&highlightElementPos={$hitPos}#s{$hitPos}">Page <xsl:value-of select="$hitPN"/>, Sentence <xsl:value-of select="$hitPos"/></a> / <a href="?{$documentValue}&pn={$hitPN + 1}&{$modeValue}&query-type={$queryType}{$queryValueEscaped2}&query-result-pn={$queryResultPN}#s0">Page <xsl:value-of select="$hitPN + 1"/>, continuation of the sentence</a> |
549 </xsl:otherwise> | 558 </xsl:otherwise> |
550 </xsl:choose> | 559 </xsl:choose> |
551 :<br/> | 560 :<br/> |
552 <!-- Highlight the query terms in each hit sentence and clip the result --> | 561 <!-- Highlight the query terms in each hit sentence and clip the result --> |
553 <xsl:sequence select="text:highlight(s, $ftQueryTerms, $ftQueryHighlightWords, 'true')"/> | 562 <xsl:sequence select="text:highlight($hitString, $ftQueryTerms, $ftQueryHighlightWords, 'true')"/> |
554 </td> | 563 </td> |
555 </tr> | 564 </tr> |
556 </xsl:for-each> | 565 </xsl:for-each> |
557 </table> | 566 </table> |
558 </xsl:if> | 567 </xsl:if> |
657 </xsl:copy> | 666 </xsl:copy> |
658 </xsl:template> | 667 </xsl:template> |
659 | 668 |
660 <xsl:template match="element()|comment()|processing-instruction()" mode="xml"> | 669 <xsl:template match="element()|comment()|processing-instruction()" mode="xml"> |
661 <xsl:variable name="elementName" select="name()"/> | 670 <xsl:variable name="elementName" select="name()"/> |
671 <xsl:variable name="countPrecedingElemsStr" select="concat('count(preceding::', $elementName, '[. >> $p1]) + 1')"/> | |
662 <xsl:variable name="elementPresentation"> | 672 <xsl:variable name="elementPresentation"> |
663 <xsl:choose> | 673 <xsl:choose> |
664 <xsl:when test="element() = node() or text() != '' or self::comment() or self::processing-instruction()"> | 674 <xsl:when test="element() = node() or text() != '' or self::comment() or self::processing-instruction()"> |
665 <xsl:value-of select="'<'"/> | 675 <xsl:value-of select="'<'"/> |
666 <span class="xml elementName"><xsl:value-of select="$elementName"/></span> | 676 <span class="xml elementName"><xsl:value-of select="$elementName"/></span> |
677 <xsl:apply-templates select="attribute()" mode="xml"/> | 687 <xsl:apply-templates select="attribute()" mode="xml"/> |
678 <xsl:value-of select="'/>'"/> | 688 <xsl:value-of select="'/>'"/> |
679 </xsl:otherwise> | 689 </xsl:otherwise> |
680 </xsl:choose> | 690 </xsl:choose> |
681 </xsl:variable> | 691 </xsl:variable> |
682 <xsl:variable name="actualSN"> | 692 <xsl:variable name="currentHighlightElementPos"> |
683 <xsl:choose> | 693 <xsl:choose> |
684 <xsl:when test=". = $firstSentence and ($topPB >> .)">0</xsl:when> | 694 <xsl:when test="($highlightElement = 's' or $highlightElement = '') and . = $firstSentence and ($topPB >> .)">0</xsl:when> |
685 <xsl:otherwise><xsl:value-of select="count(preceding::s[. >> $topPB]) + 1"/></xsl:otherwise> | 695 <xsl:when test="$highlightElement = 's' or $highlightElement = ''"><xsl:value-of select="saxon:evaluate($countPrecedingElemsStr, $topPB)"/></xsl:when> |
696 <xsl:otherwise><xsl:value-of select="saxon:evaluate($countPrecedingElemsStr, $topPB)"/></xsl:otherwise> | |
686 </xsl:choose> | 697 </xsl:choose> |
687 </xsl:variable> | 698 </xsl:variable> |
688 <xsl:choose> | 699 <xsl:variable name="class"> |
689 <!-- Show the sentence in color light grey if it is given as sn --> | 700 <xsl:choose> |
690 <xsl:when test="$elementName = 's' and $sn >= 0 and $sn = $actualSN"> | 701 <xsl:when test="($sn >= 0 and $sn = $currentHighlightElementPos) or ($elementName = $highlightElement and $highlightElementPos >= 0 and $highlightElementPos = $currentHighlightElementPos)"><xsl:value-of select="'xml element highlight'"/></xsl:when> |
691 <ul class="xml element highlight"> | 702 <xsl:when test="$elementName = $highlightElement and $highlightElementPos >= 0 and $highlightElementPos != $currentHighlightElementPos"><xsl:value-of select="'xml element'"/></xsl:when> |
692 <a name="sn{$actualSN}"></a><xsl:sequence select="$elementPresentation"/> | 703 <xsl:otherwise><xsl:value-of select="'xml element'"/></xsl:otherwise> |
693 </ul> | 704 </xsl:choose> |
694 </xsl:when> | 705 </xsl:variable> |
695 <xsl:when test="$elementName = 's' and $sn != $actualSN"> | 706 <!-- Show the sentence in color light grey if it is given as highlightElementPos --> |
696 <ul class="xml element"> | 707 <ul class="{$class}" id="{$elementName}{$currentHighlightElementPos}"> |
697 <a name="sn{$actualSN}"></a><xsl:sequence select="$elementPresentation"/> | 708 <xsl:sequence select="$elementPresentation"/> |
698 </ul> | 709 </ul> |
699 </xsl:when> | |
700 <xsl:otherwise> | |
701 <ul class="xml element"> | |
702 <xsl:sequence select="$elementPresentation"/> | |
703 </ul> | |
704 </xsl:otherwise> | |
705 </xsl:choose> | |
706 </xsl:template> | 710 </xsl:template> |
707 | 711 |
708 <xsl:template match="attribute()" mode="xml"> | 712 <xsl:template match="attribute()" mode="xml"> |
709 <xsl:variable name="attributeName" select="name()"/> | 713 <xsl:variable name="attributeName" select="name()"/> |
710 <span class="xml attributeName"> | 714 <span class="xml attributeName"> |
716 <xsl:apply-templates select="attribute()" mode="xml"/> | 720 <xsl:apply-templates select="attribute()" mode="xml"/> |
717 </xsl:template> | 721 </xsl:template> |
718 | 722 |
719 <!-- If ft-query is set then highlight all term occurrences in each little text piece for the fulltext query --> | 723 <!-- If ft-query is set then highlight all term occurrences in each little text piece for the fulltext query --> |
720 <xsl:template match="text()" mode="xml"> | 724 <xsl:template match="text()" mode="xml"> |
721 <xsl:variable name="parentS" select="./ancestor::s"/> | 725 <xsl:variable name="ancestorStr" select="concat('./ancestor::', $highlightElement)"/> |
722 <xsl:variable name="actualSN"> | 726 <xsl:variable name="highlightElementAncestor"> |
723 <xsl:choose> | 727 <xsl:choose> |
724 <xsl:when test="$parentS = $firstSentence and ($topPB >> $parentS)">0</xsl:when> | 728 <xsl:when test="$highlightElement = 's' or $highlightElement = ''"><xsl:sequence select="./ancestor::s"/></xsl:when> |
725 <xsl:otherwise><xsl:value-of select="count(preceding::s[. >> $topPB]) + 1"/></xsl:otherwise> | 729 <xsl:otherwise><xsl:sequence select="saxon:evaluate($ancestorStr)"/></xsl:otherwise> |
726 </xsl:choose> | 730 </xsl:choose> |
727 </xsl:variable> | 731 </xsl:variable> |
728 <xsl:choose> | 732 <xsl:variable name="highlightElementAncestorType" select="name($highlightElementAncestor/*[1])"/> |
729 <xsl:when test="$ftQueryMode != 'false' and $sn >= 0 and $sn = $actualSN"> | 733 <xsl:variable name="countPrecedingElemsStr" select="concat('count(preceding::', $highlightElement, '[. >> $p1]) + 1')"/> |
734 <xsl:variable name="currentHighlightElementPos"> | |
735 <xsl:choose> | |
736 <xsl:when test="($highlightElement = 's' or $highlightElement = '') and $highlightElementAncestor = $firstSentence and ($topPB >> $highlightElementAncestor)">0</xsl:when> | |
737 <xsl:when test="$highlightElement = 's' or $highlightElement = ''"><xsl:value-of select="saxon:evaluate($countPrecedingElemsStr, $topPB)"/></xsl:when> | |
738 <xsl:otherwise><xsl:value-of select="saxon:evaluate($countPrecedingElemsStr, $topPB)"/></xsl:otherwise> | |
739 </xsl:choose> | |
740 </xsl:variable> | |
741 <xsl:choose> | |
742 <xsl:when test="$ftQueryMode != 'false' and $highlightElementAncestorType = $highlightElement and $highlightElementPos >= 0 and $highlightElementPos = $currentHighlightElementPos"> | |
730 <xsl:sequence select="text:highlight(string(.), $ftQueryTerms, $ftQueryHighlightWords, 'false')"/> | 743 <xsl:sequence select="text:highlight(string(.), $ftQueryTerms, $ftQueryHighlightWords, 'false')"/> |
731 </xsl:when> | 744 </xsl:when> |
732 <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise> | 745 <xsl:otherwise> |
746 <xsl:value-of select="."/> | |
747 </xsl:otherwise> | |
733 </xsl:choose> | 748 </xsl:choose> |
734 </xsl:template> | 749 </xsl:template> |
735 | 750 |
736 | 751 |
737 <!-- variables used by templates in mode "text" --> | 752 <!-- variables used by templates in mode "text" --> |
864 </div> | 879 </div> |
865 </xsl:if> | 880 </xsl:if> |
866 </xsl:template> | 881 </xsl:template> |
867 | 882 |
868 <xsl:template match="head" mode="text"> | 883 <xsl:template match="head" mode="text"> |
869 <p class="bf center"><xsl:apply-templates mode="text"/></p> | 884 <xsl:variable name="currentHighlightElementPos"> |
885 <xsl:choose> | |
886 <xsl:when test="$highlightElement = 'head'"><xsl:value-of select="count(preceding::head[. >> $topPB]) + 1"/></xsl:when> | |
887 <xsl:otherwise><xsl:value-of select="0"/></xsl:otherwise> | |
888 </xsl:choose> | |
889 </xsl:variable> | |
890 <xsl:variable name="class"> | |
891 <xsl:choose> | |
892 <xsl:when test="not(empty(@style)) and $highlightElementPos >= 0 and $highlightElementPos = $currentHighlightElementPos"><xsl:value-of select="concat('head highlight bf ', @style)"/></xsl:when> | |
893 <xsl:when test="empty(@style) and $highlightElementPos >= 0 and $highlightElementPos = $currentHighlightElementPos"><xsl:value-of select="'head highlight bf'"/></xsl:when> | |
894 <xsl:otherwise><xsl:value-of select="'head bf'"/></xsl:otherwise> | |
895 </xsl:choose> | |
896 </xsl:variable> | |
897 <p> | |
898 <span> | |
899 <xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute> | |
900 <xsl:attribute name="id"><xsl:value-of select="concat('head', $currentHighlightElementPos)"/></xsl:attribute> | |
901 <xsl:apply-templates mode="text"/> | |
902 </span> | |
903 </p> | |
870 </xsl:template> | 904 </xsl:template> |
871 | 905 |
872 <!-- TEI: segmentation --> | 906 <!-- TEI: segmentation --> |
873 <xsl:template match="seg" mode="text"> | 907 <xsl:template match="seg" mode="text"> |
874 <xsl:choose> | 908 <xsl:choose> |
1126 <xsl:apply-templates mode="text"/> | 1160 <xsl:apply-templates mode="text"/> |
1127 </div> | 1161 </div> |
1128 </xsl:template> | 1162 </xsl:template> |
1129 | 1163 |
1130 <xsl:template match="p" mode="text"> | 1164 <xsl:template match="p" mode="text"> |
1165 <xsl:variable name="currentHighlightElementPos"> | |
1166 <xsl:choose> | |
1167 <xsl:when test="$highlightElement = 'p'"><xsl:value-of select="count(preceding::p[. >> $topPB]) + 1"/></xsl:when> | |
1168 <xsl:otherwise><xsl:value-of select="0"/></xsl:otherwise> | |
1169 </xsl:choose> | |
1170 </xsl:variable> | |
1131 <xsl:variable name="style" select="@style"/> | 1171 <xsl:variable name="style" select="@style"/> |
1172 <xsl:variable name="class"> | |
1173 <xsl:choose> | |
1174 <xsl:when test="not(empty(@style)) and $highlightElementPos >= 0 and $highlightElementPos = $currentHighlightElementPos"><xsl:value-of select="concat('p highlight ', @style)"/></xsl:when> | |
1175 <xsl:when test="empty(@style) and $highlightElementPos >= 0 and $highlightElementPos = $currentHighlightElementPos"><xsl:value-of select="'p highlight'"/></xsl:when> | |
1176 <xsl:otherwise><xsl:value-of select="'p'"/></xsl:otherwise> | |
1177 </xsl:choose> | |
1178 </xsl:variable> | |
1132 <xsl:choose> | 1179 <xsl:choose> |
1133 <xsl:when test="not(empty($style))"> | 1180 <xsl:when test="not(empty($style))"> |
1134 <div> | 1181 <div> |
1135 <xsl:attribute name="class"><xsl:value-of select="'p'"/></xsl:attribute> | 1182 <xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute> |
1136 <span> | 1183 <span> |
1137 <xsl:attribute name="class"><xsl:value-of select="$style"/></xsl:attribute> | 1184 <xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute> |
1185 <xsl:attribute name="id"><xsl:value-of select="concat('p', $currentHighlightElementPos)"/></xsl:attribute> | |
1138 <xsl:apply-templates mode="text"/> | 1186 <xsl:apply-templates mode="text"/> |
1139 </span> | 1187 </span> |
1140 </div> | 1188 </div> |
1141 </xsl:when> | 1189 </xsl:when> |
1142 <xsl:otherwise> | 1190 <xsl:otherwise> |
1143 <div> | 1191 <div> |
1144 <xsl:attribute name="class"><xsl:value-of select="'p'"/></xsl:attribute> | 1192 <xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute> |
1193 <xsl:attribute name="id"><xsl:value-of select="concat('p', $currentHighlightElementPos)"/></xsl:attribute> | |
1145 <xsl:apply-templates mode="text"/> | 1194 <xsl:apply-templates mode="text"/> |
1146 </div> | 1195 </div> |
1147 </xsl:otherwise> | 1196 </xsl:otherwise> |
1148 </xsl:choose> | 1197 </xsl:choose> |
1149 </xsl:template> | 1198 </xsl:template> |
1162 <xsl:template match="cb" mode="text"> | 1211 <xsl:template match="cb" mode="text"> |
1163 <br/><xsl:apply-templates mode="text"/> | 1212 <br/><xsl:apply-templates mode="text"/> |
1164 </xsl:template> | 1213 </xsl:template> |
1165 | 1214 |
1166 <xsl:template match="expan" mode="text"> | 1215 <xsl:template match="expan" mode="text"> |
1167 <xsl:apply-templates mode="text"/> | 1216 <xsl:choose> |
1217 <xsl:when test="not(empty(@style))"> | |
1218 <span> | |
1219 <xsl:attribute name="class"><xsl:value-of select="concat('expan ', @style)"/></xsl:attribute> | |
1220 <xsl:apply-templates mode="text"/> | |
1221 </span> | |
1222 </xsl:when> | |
1223 <xsl:otherwise> | |
1224 <span class="expan"><xsl:apply-templates mode="text"/></span> | |
1225 </xsl:otherwise> | |
1226 </xsl:choose> | |
1168 </xsl:template> | 1227 </xsl:template> |
1169 | 1228 |
1170 <xsl:template match="note" mode="text"> | 1229 <xsl:template match="note" mode="text"> |
1171 <xsl:variable name="hasLabel" select="string(@xlink:label) != ''"/> | 1230 <xsl:variable name="hasLabel" select="string(@xlink:label) != ''"/> |
1172 <xsl:variable name="place" select="@place"/> | 1231 <xsl:variable name="place" select="@place"/> |
1224 <xsl:choose> | 1283 <xsl:choose> |
1225 <xsl:when test="$length < 2 or empty($length)"><xsl:value-of select="''"/></xsl:when> | 1284 <xsl:when test="$length < 2 or empty($length)"><xsl:value-of select="''"/></xsl:when> |
1226 <xsl:otherwise> | 1285 <xsl:otherwise> |
1227 <xsl:choose> | 1286 <xsl:choose> |
1228 <xsl:when test="not(empty(w))"> | 1287 <xsl:when test="not(empty(w))"> |
1229 <a class="textPollux" href="interface/lt/wordInfo.xql?language={w/@lang}&word={w/@form}&output=html"><xsl:value-of select="$restChars"/></a> | 1288 <a class="textPollux" href="interface/lt/wordInfo.xql?language={w/@lang}&display={$text}&word={w/@form}&output=html"><xsl:value-of select="$restChars"/></a> |
1230 </xsl:when> | 1289 </xsl:when> |
1231 <xsl:otherwise><xsl:value-of select="$restChars"/></xsl:otherwise> | 1290 <xsl:otherwise><xsl:value-of select="$restChars"/></xsl:otherwise> |
1232 </xsl:choose> | 1291 </xsl:choose> |
1233 </xsl:otherwise> | 1292 </xsl:otherwise> |
1234 </xsl:choose> | 1293 </xsl:choose> |
1235 </xsl:variable> | 1294 </xsl:variable> |
1236 <xsl:choose> | 1295 <xsl:choose> |
1237 <xsl:when test="$collectionName = 'echo' and not(contains($style, 'sc'))"> | 1296 <xsl:when test="$collectionName = 'echo' and not(contains($style, 'sc'))"> |
1238 <span class="{$style}"><xsl:apply-templates mode="text"/></span> | 1297 <span class="{$style}"><xsl:apply-templates mode="text"/></span> |
1239 </xsl:when> | 1298 </xsl:when> |
1299 <xsl:when test="$collectionName = 'echo' and $style = 'sc' and $length = 1"> | |
1300 <span class="sc"><xsl:value-of select="$firstChar"/></span> | |
1301 </xsl:when> | |
1240 <xsl:when test="$collectionName = 'echo' and $style = 'sc' and $first2CharsAreUppercase"> | 1302 <xsl:when test="$collectionName = 'echo' and $style = 'sc' and $first2CharsAreUppercase"> |
1241 <span class="dc"><xsl:value-of select="$firstChar"/></span><span class="sc"><xsl:sequence select="$rest"/></span> | 1303 <span class="dc"><xsl:value-of select="$firstChar"/></span><span class="sc"><xsl:sequence select="$rest"/></span> |
1242 </xsl:when> | 1304 </xsl:when> |
1243 <xsl:when test="$collectionName = 'echo' and contains($style, 'sc') and $first2CharsAreUppercase"> | 1305 <xsl:when test="$collectionName = 'echo' and contains($style, 'sc') and $first2CharsAreUppercase"> |
1244 <span class="dc"><span class="{$styleWithoutSC}"><xsl:value-of select="$firstChar"/></span></span><span class="sc"><span class="{$styleWithoutSC}"><xsl:sequence select="$rest"/></span></span> | 1306 <span class="dc"><span class="{$styleWithoutSC}"><xsl:value-of select="$firstChar"/></span></span><span class="sc"><span class="{$styleWithoutSC}"><xsl:sequence select="$rest"/></span></span> |
1245 </xsl:when> | 1307 </xsl:when> |
1246 <xsl:when test="$collectionName = 'echo' and $style = 'sc' and not($first2CharsAreUppercase)"> | 1308 <xsl:when test="$collectionName = 'echo' and $style = 'sc' and not($first2CharsAreUppercase)"> |
1247 <xsl:apply-templates mode="text"/> | 1309 <span class="sc"><xsl:apply-templates mode="text"/></span> |
1248 </xsl:when> | 1310 </xsl:when> |
1249 <xsl:when test="$collectionName = 'echo' and contains($style, 'sc') and not($first2CharsAreUppercase)"> | 1311 <xsl:when test="$collectionName = 'echo' and contains($style, 'sc') and not($first2CharsAreUppercase)"> |
1250 <span class="sc"><span class="{$styleWithoutSC}"><xsl:apply-templates mode="text"/></span></span> | 1312 <span class="sc"><span class="{$styleWithoutSC}"><xsl:apply-templates mode="text"/></span></span> |
1251 </xsl:when> | 1313 </xsl:when> |
1252 <xsl:when test="$collectionName = 'archimedes'"> | 1314 <xsl:when test="$collectionName = 'archimedes'"> |
1271 <xsl:apply-templates mode="text"/> | 1333 <xsl:apply-templates mode="text"/> |
1272 </span> | 1334 </span> |
1273 </xsl:template> | 1335 </xsl:template> |
1274 | 1336 |
1275 <xsl:template match="q" mode="text"> | 1337 <xsl:template match="q" mode="text"> |
1276 <span class="q"><xsl:apply-templates mode="text"/></span> | 1338 <xsl:choose> |
1339 <xsl:when test="not(empty(@style))"> | |
1340 <span> | |
1341 <xsl:attribute name="class"><xsl:value-of select="concat('q ', @style)"/></xsl:attribute> | |
1342 <xsl:apply-templates mode="text"/> | |
1343 </span> | |
1344 </xsl:when> | |
1345 <xsl:otherwise> | |
1346 <span class="q"><xsl:apply-templates mode="text"/></span> | |
1347 </xsl:otherwise> | |
1348 </xsl:choose> | |
1277 </xsl:template> | 1349 </xsl:template> |
1278 | 1350 |
1279 <xsl:template match="quote" mode="text"> | 1351 <xsl:template match="quote" mode="text"> |
1280 <div class="quote"><xsl:apply-templates mode="text"/></div> | 1352 <xsl:choose> |
1353 <xsl:when test="not(empty(@style))"> | |
1354 <div> | |
1355 <xsl:attribute name="class"><xsl:value-of select="concat('quote ', @style)"/></xsl:attribute> | |
1356 <xsl:apply-templates mode="text"/> | |
1357 </div> | |
1358 </xsl:when> | |
1359 <xsl:otherwise> | |
1360 <div class="quote"><xsl:apply-templates mode="text"/></div> | |
1361 </xsl:otherwise> | |
1362 </xsl:choose> | |
1281 </xsl:template> | 1363 </xsl:template> |
1282 | 1364 |
1283 <xsl:template match="blockquote" mode="text"> | 1365 <xsl:template match="blockquote" mode="text"> |
1284 <div class="blockquote"><xsl:apply-templates mode="text"/></div> | 1366 <xsl:choose> |
1367 <xsl:when test="not(empty(@style))"> | |
1368 <div> | |
1369 <xsl:attribute name="class"><xsl:value-of select="concat('blockquote ', @style)"/></xsl:attribute> | |
1370 <xsl:apply-templates mode="text"/> | |
1371 </div> | |
1372 </xsl:when> | |
1373 <xsl:otherwise> | |
1374 <div class="blockquote"><xsl:apply-templates mode="text"/></div> | |
1375 </xsl:otherwise> | |
1376 </xsl:choose> | |
1285 </xsl:template> | 1377 </xsl:template> |
1286 | 1378 |
1287 <xsl:template match="set-off" mode="text"> | 1379 <xsl:template match="set-off" mode="text"> |
1288 <div class="set-off"><xsl:apply-templates mode="text"/></div> | 1380 <xsl:choose> |
1381 <xsl:when test="not(empty(@style))"> | |
1382 <div> | |
1383 <xsl:attribute name="class"><xsl:value-of select="concat('set-off ', @style)"/></xsl:attribute> | |
1384 <xsl:apply-templates mode="text"/> | |
1385 </div> | |
1386 </xsl:when> | |
1387 <xsl:otherwise> | |
1388 <div class="set-off"><xsl:apply-templates mode="text"/></div> | |
1389 </xsl:otherwise> | |
1390 </xsl:choose> | |
1289 </xsl:template> | 1391 </xsl:template> |
1290 | 1392 |
1291 <xsl:template match="reg" mode="text"> | 1393 <xsl:template match="reg" mode="text"> |
1292 <span class="reg"> | 1394 <xsl:choose> |
1293 <xsl:apply-templates mode="text"/> | 1395 <xsl:when test="not(empty(@style))"> |
1294 </span> | 1396 <span> |
1397 <xsl:attribute name="class"><xsl:value-of select="concat('reg ', @style)"/></xsl:attribute> | |
1398 <xsl:apply-templates mode="text"/> | |
1399 </span> | |
1400 </xsl:when> | |
1401 <xsl:otherwise> | |
1402 <span class="reg"><xsl:apply-templates mode="text"/></span> | |
1403 </xsl:otherwise> | |
1404 </xsl:choose> | |
1295 </xsl:template> | 1405 </xsl:template> |
1296 | 1406 |
1297 <xsl:template match="var" mode="text"> | 1407 <xsl:template match="var" mode="text"> |
1298 <xsl:variable name="type" select="@type"/> | 1408 <xsl:choose> |
1299 <span class="var"> | 1409 <xsl:when test="not(empty(@style))"> |
1300 <xsl:attribute name="class"><xsl:value-of select="concat('var ', $type)"/></xsl:attribute> | 1410 <span> |
1301 <xsl:apply-templates mode="text"/> | 1411 <xsl:attribute name="class"><xsl:value-of select="concat('reg ', @type, ' ', @style)"/></xsl:attribute> |
1302 </span> | 1412 <xsl:apply-templates mode="text"/> |
1413 </span> | |
1414 </xsl:when> | |
1415 <xsl:otherwise> | |
1416 <span class="var"> | |
1417 <xsl:attribute name="class"><xsl:value-of select="concat('var ', @type)"/></xsl:attribute> | |
1418 <xsl:apply-templates mode="text"/> | |
1419 </span> | |
1420 </xsl:otherwise> | |
1421 </xsl:choose> | |
1303 </xsl:template> | 1422 </xsl:template> |
1304 | 1423 |
1305 <xsl:template match="num" mode="text"> | 1424 <xsl:template match="num" mode="text"> |
1306 <span class="num"><xsl:apply-templates mode="text"/></span> | 1425 <xsl:choose> |
1426 <xsl:when test="not(empty(@style))"> | |
1427 <span> | |
1428 <xsl:attribute name="class"><xsl:value-of select="'num'"/></xsl:attribute> | |
1429 <span> | |
1430 <xsl:attribute name="class"><xsl:value-of select="@style"/></xsl:attribute> | |
1431 <xsl:apply-templates mode="text"/> | |
1432 </span> | |
1433 </span> | |
1434 </xsl:when> | |
1435 <xsl:otherwise> | |
1436 <span class="num"><xsl:apply-templates mode="text"/></span> | |
1437 </xsl:otherwise> | |
1438 </xsl:choose> | |
1307 </xsl:template> | 1439 </xsl:template> |
1308 | 1440 |
1309 <xsl:template match="gap" mode="text"> | 1441 <xsl:template match="gap" mode="text"> |
1310 <xsl:variable name="extent" select="@extent"/> | 1442 <xsl:variable name="extent" select="@extent"/> |
1311 <xsl:variable name="count"> | 1443 <xsl:variable name="count"> |
1525 | 1657 |
1526 | 1658 |
1527 <!-- textPollux links --> | 1659 <!-- textPollux links --> |
1528 <xsl:template match="w" mode="text"> | 1660 <xsl:template match="w" mode="text"> |
1529 <xsl:variable name="wordLanguage" select="@lang"/> | 1661 <xsl:variable name="wordLanguage" select="@lang"/> |
1530 <xsl:variable name="form" select="@form"/> | 1662 <xsl:variable name="form" select="encode-for-uri(@form)"/> |
1663 <xsl:variable name="displayWord"><xsl:apply-templates mode="text"/></xsl:variable> | |
1664 <xsl:variable name="displayWordUrlEncoded" select="encode-for-uri($displayWord)"/> | |
1531 <xsl:choose> | 1665 <xsl:choose> |
1532 <xsl:when test="not(empty(anchor))"> | 1666 <xsl:when test="not(empty(anchor))"> |
1533 <xsl:for-each select="node()"> | 1667 <xsl:for-each select="node()"> |
1668 <xsl:variable name="dispWord"><xsl:apply-templates mode="text" select="."/></xsl:variable> | |
1669 <xsl:variable name="dispWordUrlEncoded" select="encode-for-uri($dispWord)"/> | |
1534 <xsl:choose> | 1670 <xsl:choose> |
1535 <xsl:when test=". instance of text()"> | 1671 <xsl:when test=". instance of text()"> |
1536 <a class="textPollux"> | 1672 <a class="textPollux"> |
1537 <xsl:attribute name="href"><xsl:value-of select="concat('interface/lt/wordInfo.xql?language=', $wordLanguage, '&word=', $form, '&output=html')"/></xsl:attribute> | 1673 <xsl:attribute name="href"><xsl:value-of select="concat('interface/lt/wordInfo.xql?language=', $wordLanguage, '&display=', $dispWordUrlEncoded, '&word=', $form, '&output=html')"/></xsl:attribute> |
1538 <xsl:apply-templates mode="text" select="."/> | 1674 <xsl:sequence select="$dispWord"/> |
1539 </a> | 1675 </a> |
1540 </xsl:when> | 1676 </xsl:when> |
1541 <xsl:otherwise> | 1677 <xsl:otherwise> |
1542 <xsl:apply-templates mode="text" select="."/> | 1678 <xsl:sequence select="$dispWord"/> |
1543 </xsl:otherwise> | 1679 </xsl:otherwise> |
1544 </xsl:choose> | 1680 </xsl:choose> |
1545 </xsl:for-each> | 1681 </xsl:for-each> |
1546 </xsl:when> | 1682 </xsl:when> |
1547 <xsl:otherwise> | 1683 <xsl:otherwise> |
1548 <a class="textPollux"> | 1684 <a class="textPollux"> |
1549 <xsl:attribute name="href"><xsl:value-of select="concat('interface/lt/wordInfo.xql?language=', $wordLanguage, '&word=', $form, '&output=html')"/></xsl:attribute> | 1685 <xsl:attribute name="href"><xsl:value-of select="concat('interface/lt/wordInfo.xql?language=', $wordLanguage, '&display=', $displayWordUrlEncoded, '&word=', $form, '&output=html')"/></xsl:attribute> |
1550 <xsl:apply-templates mode="text"/> | 1686 <xsl:sequence select="$displayWord"/> |
1551 </a> | 1687 </a> |
1552 </xsl:otherwise> | 1688 </xsl:otherwise> |
1553 </xsl:choose> | 1689 </xsl:choose> |
1554 </xsl:template> | 1690 </xsl:template> |
1555 | 1691 |
1556 <xsl:template match="s" mode="text"> | 1692 <xsl:template match="s" mode="text"> |
1557 <xsl:variable name="style" select="@style"/> | 1693 <xsl:variable name="style" select="@style"/> |
1558 <xsl:variable name="actualSN"> | 1694 <xsl:variable name="currentSN"> |
1559 <xsl:choose> | 1695 <xsl:choose> |
1560 <xsl:when test=". = $firstSentence and ($topPB >> .)">0</xsl:when> | 1696 <xsl:when test=". = $firstSentence and ($topPB >> .)">0</xsl:when> |
1561 <xsl:otherwise><xsl:value-of select="count(preceding::s[. >> $topPB]) + 1"/></xsl:otherwise> | 1697 <xsl:otherwise><xsl:value-of select="count(preceding::s[. >> $topPB]) + 1"/></xsl:otherwise> |
1562 </xsl:choose> | 1698 </xsl:choose> |
1563 </xsl:variable> | 1699 </xsl:variable> |
1564 <a name="sn{$actualSN}"></a> | 1700 <xsl:choose> |
1565 <xsl:choose> | 1701 <!-- Show the sentence in color light grey if it is given as sn or highlightElem --> |
1566 <!-- Show the sentence in color light grey if it is given as sn --> | 1702 <xsl:when test="($sn >= 0 and $sn = $currentSN) or ($highlightElement = 's' and $highlightElementPos >= 0 and $highlightElementPos = $currentSN)"> |
1567 <xsl:when test="$sn >= 0 and $sn = $actualSN"> | 1703 <span class="s highlight" id="s{$currentSN}"> |
1568 <span class="s highlight"> | |
1569 <xsl:if test="not(empty(@xmlNodeId))"><xsl:attribute name="xmlNodeId"><xsl:value-of select="@xmlNodeId"/></xsl:attribute></xsl:if> | 1704 <xsl:if test="not(empty(@xmlNodeId))"><xsl:attribute name="xmlNodeId"><xsl:value-of select="@xmlNodeId"/></xsl:attribute></xsl:if> |
1570 <xsl:choose> | 1705 <xsl:choose> |
1571 <xsl:when test="empty(@style)"> | 1706 <xsl:when test="empty(@style)"> |
1572 <xsl:apply-templates mode="text"/> | 1707 <xsl:apply-templates mode="text"/> |
1573 </xsl:when> | 1708 </xsl:when> |
1576 </xsl:otherwise> | 1711 </xsl:otherwise> |
1577 </xsl:choose> | 1712 </xsl:choose> |
1578 </span> | 1713 </span> |
1579 </xsl:when> | 1714 </xsl:when> |
1580 <xsl:otherwise> | 1715 <xsl:otherwise> |
1581 <span class="s"> | 1716 <span class="s" id="s{$currentSN}"> |
1582 <xsl:if test="not(empty(@xmlNodeId))"><xsl:attribute name="xmlNodeId"><xsl:value-of select="@xmlNodeId"/></xsl:attribute></xsl:if> | 1717 <xsl:if test="not(empty(@xmlNodeId))"><xsl:attribute name="xmlNodeId"><xsl:value-of select="@xmlNodeId"/></xsl:attribute></xsl:if> |
1583 <xsl:choose> | 1718 <xsl:choose> |
1584 <xsl:when test="empty(@style)"> | 1719 <xsl:when test="empty(@style)"> |
1585 <xsl:apply-templates mode="text"/> | 1720 <xsl:apply-templates mode="text"/> |
1586 </xsl:when> | 1721 </xsl:when> |
1593 </xsl:choose> | 1728 </xsl:choose> |
1594 </xsl:template> | 1729 </xsl:template> |
1595 | 1730 |
1596 <!-- If ft-query is set then highlight all term occurrences in each little text piece for the fulltext query --> | 1731 <!-- If ft-query is set then highlight all term occurrences in each little text piece for the fulltext query --> |
1597 <xsl:template match="text()" mode="text"> | 1732 <xsl:template match="text()" mode="text"> |
1598 <xsl:variable name="parentS" select="./ancestor::s"/> | 1733 <xsl:variable name="ancestorStr" select="concat('./ancestor::', $highlightElement)"/> |
1599 <xsl:variable name="actualSN"> | 1734 <xsl:variable name="highlightElementAncestor"> |
1600 <xsl:choose> | 1735 <xsl:choose> |
1601 <xsl:when test="$parentS = $firstSentence and ($topPB >> $parentS)">0</xsl:when> | 1736 <xsl:when test="$highlightElement = 's' or $highlightElement = ''"><xsl:sequence select="./ancestor::s"/></xsl:when> |
1602 <xsl:otherwise><xsl:value-of select="count(preceding::s[. >> $topPB]) + 1"/></xsl:otherwise> | 1737 <xsl:otherwise><xsl:sequence select="saxon:evaluate($ancestorStr)"/></xsl:otherwise> |
1603 </xsl:choose> | 1738 </xsl:choose> |
1604 </xsl:variable> | 1739 </xsl:variable> |
1605 <xsl:choose> | 1740 <xsl:variable name="highlightElementAncestorType" select="name($highlightElementAncestor/*[1])"/> |
1606 <xsl:when test="$ftQueryMode != 'false' and $sn >= 0 and $sn = $actualSN"> | 1741 <xsl:variable name="countPrecedingElemsStr" select="concat('count(preceding::', $highlightElement, '[. >> $p1]) + 1')"/> |
1607 <xsl:sequence select="text:highlight(string(.), $ftQueryTerms, $ftQueryHighlightWords, 'false')"/> | 1742 <xsl:variable name="currentHighlightElementPos"> |
1608 </xsl:when> | 1743 <xsl:choose> |
1609 <xsl:otherwise> | 1744 <xsl:when test="($highlightElement = 's' or $highlightElement = '') and $highlightElementAncestor = $firstSentence and ($topPB >> $highlightElementAncestor)">0</xsl:when> |
1610 <xsl:value-of select="."/> | 1745 <xsl:when test="$highlightElement = 's' or $highlightElement = ''"><xsl:value-of select="saxon:evaluate($countPrecedingElemsStr, $topPB)"/></xsl:when> |
1611 </xsl:otherwise> | 1746 <xsl:otherwise><xsl:value-of select="saxon:evaluate($countPrecedingElemsStr, $topPB)"/></xsl:otherwise> |
1747 </xsl:choose> | |
1748 </xsl:variable> | |
1749 <xsl:choose> | |
1750 <xsl:when test="$ftQueryMode != 'false' and $highlightElementAncestorType = $highlightElement and $highlightElementPos >= 0 and $highlightElementPos = $currentHighlightElementPos"> | |
1751 <xsl:sequence select="text:highlight(string(.), $ftQueryTerms, $ftQueryHighlightWords, 'false')"/> | |
1752 </xsl:when> | |
1753 <xsl:otherwise> | |
1754 <xsl:value-of select="."/> | |
1755 </xsl:otherwise> | |
1612 </xsl:choose> | 1756 </xsl:choose> |
1613 </xsl:template> | 1757 </xsl:template> |
1614 | 1758 |
1615 </xsl:stylesheet> | 1759 </xsl:stylesheet> |