Lines 12-21
Link Here
|
12 |
<xsl:template match="text()"/> |
12 |
<xsl:template match="text()"/> |
13 |
|
13 |
|
14 |
<!-- Keys on tags referenced in the index definitions --> |
14 |
<!-- Keys on tags referenced in the index definitions --> |
15 |
<xsl:key name="index_control_field_tag" match="kohaidx:index_control_field" use="@tag"/> |
15 |
<xsl:key name="index_control_field_tag" match="kohaidx:index_control_field" use="@tag"/> |
16 |
<xsl:key name="index_subfields_tag" match="kohaidx:index_subfields" use="@tag"/> |
16 |
<xsl:key name="index_subfields_tag" match="kohaidx:index_subfields" use="@tag"/> |
17 |
<xsl:key name="index_heading_tag" match="kohaidx:index_heading" use="@tag"/> |
17 |
<xsl:key name="index_facet_tag" match="kohaidx:facet" use="@tag"/> |
18 |
<xsl:key name="index_data_field_tag" match="kohaidx:index_data_field" use="@tag"/> |
18 |
<xsl:key name="index_heading_tag" match="kohaidx:index_heading" use="@tag"/> |
|
|
19 |
<xsl:key name="index_data_field_tag" match="kohaidx:index_data_field" use="@tag"/> |
19 |
<xsl:key name="index_heading_conditional_tag" match="kohaidx:index_heading_conditional" use="@tag"/> |
20 |
<xsl:key name="index_heading_conditional_tag" match="kohaidx:index_heading_conditional" use="@tag"/> |
20 |
<xsl:key name="index_match_heading_tag" match="kohaidx:index_match_heading" use="@tag"/> |
21 |
<xsl:key name="index_match_heading_tag" match="kohaidx:index_match_heading" use="@tag"/> |
21 |
|
22 |
|
Lines 33-38
definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
Link Here
|
33 |
<xslo:template match="text()"/> |
34 |
<xslo:template match="text()"/> |
34 |
<xslo:template match="text()" mode="index_subfields"/> |
35 |
<xslo:template match="text()" mode="index_subfields"/> |
35 |
<xslo:template match="text()" mode="index_data_field"/> |
36 |
<xslo:template match="text()" mode="index_data_field"/> |
|
|
37 |
<xslo:template match="text()" mode="index_facets"/> |
36 |
<xslo:template match="text()" mode="index_heading"/> |
38 |
<xslo:template match="text()" mode="index_heading"/> |
37 |
<xslo:template match="text()" mode="index_heading_conditional"/> |
39 |
<xslo:template match="text()" mode="index_heading_conditional"/> |
38 |
<xslo:template match="text()" mode="index_match_heading"/> |
40 |
<xslo:template match="text()" mode="index_match_heading"/> |
Lines 57-62
definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
Link Here
|
57 |
<xslo:apply-templates/> |
59 |
<xslo:apply-templates/> |
58 |
<xslo:apply-templates mode="index_subfields"/> |
60 |
<xslo:apply-templates mode="index_subfields"/> |
59 |
<xslo:apply-templates mode="index_data_field"/> |
61 |
<xslo:apply-templates mode="index_data_field"/> |
|
|
62 |
<xslo:apply-templates mode="index_facets"/> |
60 |
<xslo:apply-templates mode="index_heading"/> |
63 |
<xslo:apply-templates mode="index_heading"/> |
61 |
<xslo:apply-templates mode="index_heading_conditional"/> |
64 |
<xslo:apply-templates mode="index_heading_conditional"/> |
62 |
<xslo:apply-templates mode="index_match_heading"/> |
65 |
<xslo:apply-templates mode="index_match_heading"/> |
Lines 69-74
definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
Link Here
|
69 |
<xsl:call-template name="handle-index-control-field"/> |
72 |
<xsl:call-template name="handle-index-control-field"/> |
70 |
<xsl:call-template name="handle-index-subfields"/> |
73 |
<xsl:call-template name="handle-index-subfields"/> |
71 |
<xsl:call-template name="handle-index-data-field"/> |
74 |
<xsl:call-template name="handle-index-data-field"/> |
|
|
75 |
<xsl:call-template name="handle-index-facets"/> |
72 |
<xsl:call-template name="handle-index-heading"/> |
76 |
<xsl:call-template name="handle-index-heading"/> |
73 |
<xsl:call-template name="handle-index-heading-conditional"/> |
77 |
<xsl:call-template name="handle-index-heading-conditional"/> |
74 |
<xsl:call-template name="handle-index-match-heading"/> |
78 |
<xsl:call-template name="handle-index-match-heading"/> |
Lines 104-110
definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
Link Here
|
104 |
</xslo:variable> |
108 |
</xslo:variable> |
105 |
</xsl:template> |
109 |
</xsl:template> |
106 |
|
110 |
|
107 |
<xsl:template match="kohaidx:index_subject_thesaurus"> |
111 |
<xsl:template match="kohaidx:index_subject_thesaurus"> |
108 |
<xsl:variable name="tag"><xsl:value-of select="@tag"/></xsl:variable> |
112 |
<xsl:variable name="tag"><xsl:value-of select="@tag"/></xsl:variable> |
109 |
<xsl:variable name="offset"><xsl:value-of select="@offset"/></xsl:variable> |
113 |
<xsl:variable name="offset"><xsl:value-of select="@offset"/></xsl:variable> |
110 |
<xsl:variable name="length"><xsl:value-of select="@length"/></xsl:variable> |
114 |
<xsl:variable name="length"><xsl:value-of select="@length"/></xsl:variable> |
Lines 288-293
definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
Link Here
|
288 |
</xslo:for-each> |
292 |
</xslo:for-each> |
289 |
</xsl:template> |
293 |
</xsl:template> |
290 |
|
294 |
|
|
|
295 |
<xsl:template name="handle-index-facets"> |
296 |
<xsl:for-each select="//kohaidx:facet[generate-id() = generate-id(key('index_facet_tag', @tag)[1])]"> |
297 |
<xslo:template mode="index_facets"> |
298 |
<xsl:attribute name="match"> |
299 |
<xsl:text>marc:datafield[@tag='</xsl:text> |
300 |
<xsl:value-of select="@tag"/> |
301 |
<xsl:text>']</xsl:text> |
302 |
</xsl:attribute> |
303 |
<xslo:if> |
304 |
<xsl:attribute name="test"> |
305 |
<xsl:text>not(@ind1='z')</xsl:text> |
306 |
</xsl:attribute> |
307 |
<xsl:for-each select="key('index_facet_tag', @tag)"> |
308 |
<xsl:variable name="indexes"> |
309 |
<xsl:call-template name="get-facets-target-indexes"/> |
310 |
</xsl:variable> |
311 |
<xsl:if test="not($indexes='')"> |
312 |
<z:index> |
313 |
<xsl:attribute name="name"> |
314 |
<xsl:value-of select="normalize-space($indexes)"/> |
315 |
</xsl:attribute> |
316 |
<xsl:call-template name="build-facet-value"> |
317 |
<xsl:with-param name="subfields" select="@subfields"/> |
318 |
</xsl:call-template> |
319 |
</z:index> |
320 |
</xsl:if> |
321 |
</xsl:for-each> |
322 |
</xslo:if> |
323 |
</xslo:template> |
324 |
</xsl:for-each> |
325 |
</xsl:template> |
326 |
|
291 |
<xsl:template name="handle-index-data-field"> |
327 |
<xsl:template name="handle-index-data-field"> |
292 |
<xsl:for-each select="//kohaidx:index_data_field[generate-id() = generate-id(key('index_data_field_tag', @tag)[1])]"> |
328 |
<xsl:for-each select="//kohaidx:index_data_field[generate-id() = generate-id(key('index_data_field_tag', @tag)[1])]"> |
293 |
<xslo:template mode="index_data_field"> |
329 |
<xslo:template mode="index_data_field"> |
Lines 475-478
definition file (probably something like {biblio,authority}-koha-indexdefs.xml)
Link Here
|
475 |
<xsl:value-of select="." /><xsl:text> </xsl:text> |
511 |
<xsl:value-of select="." /><xsl:text> </xsl:text> |
476 |
</xsl:for-each> |
512 |
</xsl:for-each> |
477 |
</xsl:template> |
513 |
</xsl:template> |
|
|
514 |
|
515 |
<xsl:template name="get-facets-target-indexes"> |
516 |
<xsl:for-each select="kohaidx:target_index"> |
517 |
<xsl:value-of select="." /><xsl:text> </xsl:text> |
518 |
</xsl:for-each> |
519 |
</xsl:template> |
520 |
|
521 |
<!-- traverse subfields string character-wise --> |
522 |
<xsl:template name="build-facet-value"> |
523 |
<xsl:param name="subfields"/> |
524 |
<xsl:if test="string-length($subfields) > 0"> |
525 |
<xslo:value-of> |
526 |
<xsl:attribute name="select"> |
527 |
<xsl:text>marc:subfield[@code='</xsl:text> |
528 |
<xsl:value-of select="substring($subfields,1,1)"/> |
529 |
<xsl:text>']</xsl:text> |
530 |
</xsl:attribute> |
531 |
</xslo:value-of> |
532 |
<xsl:call-template name="build-facet-value-cont"> |
533 |
<xsl:with-param name="prev" select="substring($subfields,1,1)"/> |
534 |
<xsl:with-param name="subfields" select="substring($subfields,2)"/> |
535 |
</xsl:call-template> |
536 |
</xsl:if> |
537 |
</xsl:template> |
538 |
<!-- traverse the remainder of @subfields, with context information |
539 |
i.e previous char. Introduces a separator character if needed --> |
540 |
<xsl:template name="build-facet-value-cont"> |
541 |
<xsl:param name="prev"/> |
542 |
<xsl:param name="subfields"/> |
543 |
<xsl:if test="string-length($subfields) > 0"> |
544 |
<xslo:if> |
545 |
<xsl:attribute name="test"> |
546 |
<xsl:text>marc:subfield[@code='</xsl:text> |
547 |
<xsl:value-of select="$prev"/> |
548 |
<xsl:text>'] and marc:subfield[@code='</xsl:text> |
549 |
<xsl:value-of select="substring($subfields,1,1)"/> |
550 |
<xsl:text>']</xsl:text> |
551 |
</xsl:attribute> |
552 |
<xslo:text><*></xslo:text> |
553 |
</xslo:if> |
554 |
<xslo:value-of> |
555 |
<xsl:attribute name="select"> |
556 |
<xsl:text>marc:subfield[@code='</xsl:text> |
557 |
<xsl:value-of select="substring($subfields,1,1)"/> |
558 |
<xsl:text>']</xsl:text> |
559 |
</xsl:attribute> |
560 |
</xslo:value-of> |
561 |
<xsl:call-template name="build-facet-value-cont"> |
562 |
<xsl:with-param name="prev" select="substring($subfields,1,1)"/> |
563 |
<xsl:with-param name="subfields" select="substring($subfields,2)"/> |
564 |
</xsl:call-template> |
565 |
</xsl:if> |
566 |
</xsl:template> |
567 |
|
478 |
</xsl:stylesheet> |
568 |
</xsl:stylesheet> |
479 |
- |
|
|