View | Details | Raw Unified | Return to bug 7441
Collapse All | Expand All

(-)a/koha-tmpl/opac-tmpl/prog/en/xslt/UNIMARCslim2OPACResults.xsl (-42 / +57 lines)
Lines 11-17 Link Here
11
<xsl:import href="UNIMARCslimUtils.xsl"/>
11
<xsl:import href="UNIMARCslimUtils.xsl"/>
12
<xsl:output method = "html" indent="yes" omit-xml-declaration = "yes" encoding="UTF-8"/>
12
<xsl:output method = "html" indent="yes" omit-xml-declaration = "yes" encoding="UTF-8"/>
13
<xsl:key name="item-by-status" match="items:item" use="items:status"/>
13
<xsl:key name="item-by-status" match="items:item" use="items:status"/>
14
<xsl:key name="item-by-status-and-branch" match="items:item" use="concat(items:status, ' ', items:homebranch)"/>
14
<xsl:key name="item-by-status-and-branch-holding" match="items:item" use="concat(items:status, ' ', items:holdingbranch)"/>
15
<xsl:key name="item-by-status-and-branch-home"    match="items:item" use="concat(items:status, ' ', items:homebranch)"/>
16
15
17
16
<xsl:template match="/">
18
<xsl:template match="/">
17
  <xsl:apply-templates/>
19
  <xsl:apply-templates/>
Lines 26-31 Link Here
26
  <xsl:variable name="isbn"
28
  <xsl:variable name="isbn"
27
   select="marc:datafield[@tag=010]/marc:subfield[@code='a']"/>
29
   select="marc:datafield[@tag=010]/marc:subfield[@code='a']"/>
28
30
31
  <xsl:variable name="OPACResultsBranchXSLT" select="marc:sysprefs/marc:syspref[@name='OPACResultsBranchXSLT']"/>
29
  <xsl:variable name="hidelostitems" select="marc:sysprefs/marc:syspref[@name='hidelostitems']"/>
32
  <xsl:variable name="hidelostitems" select="marc:sysprefs/marc:syspref[@name='hidelostitems']"/>
30
  <xsl:variable name="singleBranchMode" select="marc:sysprefs/marc:syspref[@name='singleBranchMode']"/>
33
  <xsl:variable name="singleBranchMode" select="marc:sysprefs/marc:syspref[@name='singleBranchMode']"/>
31
34
Lines 133-165 Link Here
133
          <b><xsl:text>Copies available for loan: </xsl:text></b>
136
          <b><xsl:text>Copies available for loan: </xsl:text></b>
134
          <xsl:variable name="available_items" select="key('item-by-status', 'available')"/>
137
          <xsl:variable name="available_items" select="key('item-by-status', 'available')"/>
135
      <xsl:choose>
138
      <xsl:choose>
136
      <xsl:when test="$singleBranchMode=1">
139
        <xsl:when test="$singleBranchMode=1">
137
      <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch))[1])]">
140
          <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch))[1])]">
138
        <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
141
            <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
139
          <xsl:text> (</xsl:text>
140
          <xsl:value-of select="count(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch)))"/>
141
          <xsl:text>)</xsl:text>
142
          <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
143
      </xsl:for-each>
144
      </xsl:when>
145
      <xsl:otherwise>
146
          <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch))[1])]">
147
            <xsl:value-of select="items:homebranch"/>
148
  			    <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber">[<xsl:value-of select="items:itemcallnumber"/>]
149
  			    </xsl:if>
150
            <xsl:text> (</xsl:text>
142
            <xsl:text> (</xsl:text>
151
            <xsl:value-of select="count(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch)))"/>
143
            <xsl:value-of select="count(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch)))"/>
152
            <xsl:text>)</xsl:text>
144
            <xsl:text>)</xsl:text>
153
            <xsl:choose>
145
            <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
154
              <xsl:when test="position()=last()">
155
                <xsl:text>. </xsl:text>
156
              </xsl:when>
157
              <xsl:otherwise>
158
                <xsl:text>, </xsl:text>
159
              </xsl:otherwise>
160
            </xsl:choose>
161
          </xsl:for-each>
146
          </xsl:for-each>
162
      </xsl:otherwise>
147
        </xsl:when>
148
        <xsl:otherwise>
149
          <xsl:choose>
150
            <xsl:when test="$OPACResultsBranchXSLT='homebranch'">
151
              <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch))[1])]">
152
                <xsl:value-of select="items:homebranch"/>
153
                <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
154
                <xsl:text> (</xsl:text>
155
                <xsl:value-of select="count(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch)))"/>
156
                <xsl:text>)</xsl:text>
157
                <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
158
              </xsl:for-each>
159
            </xsl:when>
160
            <xsl:when test="$OPACResultsBranchXSLT='holdingbranch'">
161
              <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch-holding', concat(items:status, ' ', items:holdingbranch))[1])]">
162
                <xsl:value-of select="items:holdingbranch"/>
163
                <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
164
                <xsl:text> (</xsl:text>
165
                <xsl:value-of select="count(key('item-by-status-and-branch-holding', concat(items:status, ' ', items:holdingbranch)))"/>
166
                <xsl:text>)</xsl:text>
167
                <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
168
              </xsl:for-each>
169
            </xsl:when>
170
          </xsl:choose>
171
        </xsl:otherwise>
163
      </xsl:choose>
172
      </xsl:choose>
164
        </span>
173
        </span>
165
      </xsl:when>
174
      </xsl:when>
Lines 168-190 Link Here
168
      <xsl:when test="count(key('item-by-status', 'reference'))>0">
177
      <xsl:when test="count(key('item-by-status', 'reference'))>0">
169
        <span class="available">
178
        <span class="available">
170
          <b><xsl:text>Copies available for reference: </xsl:text></b>
179
          <b><xsl:text>Copies available for reference: </xsl:text></b>
171
          <xsl:variable name="reference_items"
180
          <xsl:variable name="reference_items" select="key('item-by-status', 'reference')"/>
172
                        select="key('item-by-status', 'reference')"/>
181
173
          <xsl:for-each select="$reference_items[generate-id() = generate-id(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch))[1])]">
182
          <xsl:choose>
174
            <xsl:value-of select="items:homebranch"/>
183
              <xsl:when test="$OPACResultsBranchXSLT='homebranch'">
175
            <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber">[<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
184
                  <xsl:for-each select="$reference_items[generate-id() = generate-id(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch))[1])]">
176
            <xsl:text> (</xsl:text>
185
                      <xsl:value-of select="items:homebranch"/>
177
            <xsl:value-of select="count(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch)))"/>
186
                      <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
178
            <xsl:text>)</xsl:text>
187
                      <xsl:text> (</xsl:text>
179
            <xsl:choose>
188
                      <xsl:value-of select="count(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch)))"/>
180
              <xsl:when test="position()=last()">
189
                      <xsl:text>)</xsl:text>
181
                <xsl:text>. </xsl:text>
190
                      <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
191
                  </xsl:for-each>
182
              </xsl:when>
192
              </xsl:when>
183
              <xsl:otherwise>
193
              <xsl:when test="$OPACResultsBranchXSLT='holdingbranch'">
184
                <xsl:text>, </xsl:text>
194
                  <xsl:for-each select="$reference_items[generate-id() = generate-id(key('item-by-status-and-branch-holding', concat(items:status, ' ', items:holdingbranch))[1])]">
185
              </xsl:otherwise>
195
                      <xsl:value-of select="items:holdingbranch"/>
186
            </xsl:choose>
196
                      <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
187
          </xsl:for-each>
197
                      <xsl:text> (</xsl:text>
198
                      <xsl:value-of select="count(key('item-by-status-and-branch-holding', concat(items:status, ' ', items:holdingbranch)))"/>
199
                      <xsl:text>)</xsl:text>
200
                      <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
201
                  </xsl:for-each>
202
              </xsl:when>
203
          </xsl:choose>
188
        </span>
204
        </span>
189
      </xsl:when>
205
      </xsl:when>
190
    </xsl:choose>
206
    </xsl:choose>
191
- 

Return to bug 7441