[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Display order


Subject: [xsl] Display order
From: "Joseph Tan" <Joseph.Tan@xxxxxxxxxxxxxxxxxx>
Date: Thu, 28 Aug 2003 15:40:20 -0500

How do I achieve the display below. (this is a record retrieved from the
library catalog)

Holdings: South Campus Library, Vol 1- 1958- Not Owned: 84n5c(1999),
North Campus Library, Vol 71-86 1993-2000 Not owned: 71n18(1993) 

Current display: 

Holdings:Vol 71-86 1993-2000 Not owned: 71n18(1993), Vol 1- 1958- Not
Owned: 84n5c(1999), North Campus Library, South Campus Library

XSL code:

<xsl:template name="DisplayRemainder">
	<xsl:param name="items"/>
	<xsl:variable name="separator1" select="', '"/>
	<xsl:variable name="separator2" select="'; '"/>

	<br/>
	<xsl:choose>
		<!-- ##### IF RECORD IS FROM LIBRARY CATALOG
########-->
		<xsl:when test="DBN='Library catalog'">
			<xsl:text>Holdings:</xsl:text> 
			<xsl:for-each select="$items[text()!='ONLINELIB'
and text()!='JOURNALS --' and text()!='LIBWEBSITE --' and
text()!='Online access; years vary.' and text()!='NC-JOURNAL --']">
							
				<xsl:choose>
					<xsl:when
test="contains(.,'SOUTHLIB')">South Campus Library</xsl:when>	
					<xsl:when
test="contains(.,'NORTHLIB')">North Campus Library</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="text()"/>
				</xsl:otherwise>
				</xsl:choose>
							
				<xsl:if test="position() != last()">
						<xsl:variable name="pos"
select="position()"/>
						<xsl:variable
name="next" select="$items[$pos+1]"/>
					<xsl:choose>
						<xsl:when test="name() =
name($next)"><xsl:value-of select="$separator1"/></xsl:when>
						<xsl:otherwise><xsl:value-of
select="$separator2"/></xsl:otherwise>
					</xsl:choose>
				</xsl:if>
			</xsl:for-each>
		</xsl:when>
		
		<!-- ##### IF RECORD IS FROM EJOURNALS COLLECTION 
######-->
		<xsl:otherwise>
			<xsl:for-each select="$items[name()='B2']">
				<xsl:call-template name="DisplayItem"/>
			</xsl:for-each>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

XML Input:

<SETTAGS num="1">
  <CL>1</CL> 
  <RI>2</RI> 
  <OI>100000016</OI> 
  <POI>0</POI> 
  <CI>0</CI> 
  <LCI>0</LCI> 
  <RR>100</RR> 
  <OTI>4</OTI> 
  <B1>American journal of cardiology.</B1> 
  <B4>NC-JOURNAL --</B4> 
  <B4>Vol 71-86 1993-2000 Not owned: 71n18(1993)</B4> 
  <B4>Online access; years vary.</B4> 
  <B4>LIBWEBSITE --</B4> 
  <B4>Online access; years vary.</B4> 
  <B4>JOURNALS --</B4> 
  <B4>Vol 1- 1958- Not Owned: 84n5c(1999)</B4> 
  <B4>NORTHLIB</B4> 
  <B4>ONLINELIB</B4> 
  <B4>ONLINELIB</B4> 
  <B4>SOUTHLIB</B4> 
  <B5>Am. j. cardiol.</B5> 
  <B5>Am. j. cardiol.</B5> 
  <DBC>LIBCAT</DBC> 
  <DBN>Library catalog</DBN> 
  </SETTAGS>

No, the xml input does not appear to be same for every record but if an
item is available at both NORTHLIB and SOUTHLIB, it should have very
similar input as above.

Thanks!

Joseph 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords