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

re: help with an 'or'

Subject: re: help with an 'or'
From: "Vladimir Nesterovsky" <vladimir@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 25 Nov 2008 05:33:03 -0800
re:  help with an 'or'
You might probably  do both things:
    <xsl:value-of select="translate(translate(substring-after
		(//facsimile/surface[@n=$loop-variable]/@xml:id,
		'f_'),'_',' '),'_',' ')"/>
    <xsl:value-of select="translate(translate(substring-after
		(//facsimile/surface[@n=$loop-variable]/@xml:id,
		'p_'),'_',' '),'_',' ')"/>

P.S. Note that this is only an assumption.
--
Vladimir Nesterovsky
http://www.nesterovsky-bros.com

-------- Original Message --------
> From: "Jennifer Pollard" <jp337@xxxxxxxxx>
> Sent: Tuesday, November 25, 2008 3:23 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  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
> 	select="$loop-variable"/></xsl:attribute>
>    <xsl:if test="$loop-variable = $curpage">
>         <xsl:attribute name="selected">true</xsl:attribute>
>    </xsl:if>
> 
> <xsl:choose>
> <xsl:when test="$loop-variable = 1">
>     <xsl:value-of select="translate(translate(substring-after
> 		(//facsimile/surface[@n=$loop-variable]/@xml:id,
> 		'f_'),'_',' '),'_',' ')"/>
> </xsl:when>
> 
> <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:when>
> 
> <xsl:otherwise>
>     <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_'),'_',' ')"/>
> </xsl:otherwise>
> </xsl:choose>
> 
> </xsl:element>
> 
> -----------------------------------------------
> 
> 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.5
4&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.
> 
> -Jen

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.