[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

help with an 'or'

Subject: help with an 'or'
From: Jennifer Pollard <jp337@xxxxxxxxx>
Date: Tue, 25 Nov 2008 13:02:11 +0000
 help with an 'or'
Hi, all :)

I have done a bit of searching on this question but I'm new to XSL, so I'm not sure what it is that I'm looking *for* exactly.

One of our projects is using XSL to create options in a select field:


<xsl:element name="option">

  <xsl:attribute name="value"><xsl:value-of
  <xsl:if test="$loop-variable = $curpage">
       <xsl:attribute name="selected">true</xsl:attribute>

<xsl:when test="$loop-variable = 1">
   <xsl:value-of select="translate(translate(substring-after
		'f_'),'_',' '),'_',' ')"/>

<xsl:when test="($loop-variable = $loop-limit) and
	((($loop-variable * 2) - 2) mod 2 = 0)">
   <xsl:value-of select="translate(substring-after
	(//facsimile/surface[@n=(($loop-variable * 2) - 2)]/@xml:id,
	'f_'),'_',' ')"/>

   <xsl:value-of select="translate(substring-after
	(//facsimile/surface[@n=(($loop-variable * 2) - 2)]/@xml:id,
	'f_'),'_',' ')"/> -
   <xsl:value-of select="translate(substring-after
	(//facsimile/surface[@n=(($loop-variable * 2) - 1)]/@xml:id,
	'f_'),'_',' ')"/>



The problem is that in the 'value-of select' statements, it's limiting the list to display only values that start with f_, which is fair enough - I can see where it's meant to be doing that. What I need it to do, though, is give me anything that starts with either f_ OR p_.

I'm not sure how to insert any sort of 'or' clause into those statements and still retain their ability to do what we need them to do (sometimes we get both f_ and _p on the same line. For an example of a foliated book, see: <http://scriptorium.english.cam.ac.uk/manuscripts/images/openings.php?ms=S.54&page=2>

The bit I'm trying to modify is the drop down next to the word 'Opening'. Most of the books in the collection are foliated (hence pages starting with f_) but a recent acquisition is paginated. What happens is that we get blanks instead of page numbers when the xmlid consists of p_<some number>. I have modified the code above so that page 1 and 2 are f_ and the rest are p_, but because this code is reused with all books, that does break the foliated ones. (Which I expected: I was just checking to see it worked at all! ;)

Can anyone lend me a hand with this? Apologies if I've been unclear - I'll do my best to answer any questions you might have.


Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.