xsl-list
[Top] [All Lists]

re: [xsl] help with an 'or'

2008-11-25 08:34:05
You might probably  do both things:
    <xsl:value-of select="translate(translate(substring-after
                (//facsimile/surface[(_at_)n=$loop-variable]/@xml:id,
                'f_'),'_',' '),'_',' ')"/>
    <xsl:value-of select="translate(translate(substring-after
                (//facsimile/surface[(_at_)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(_at_)cam(_dot_)ac(_dot_)uk>
Sent: Tuesday, November 25, 2008 3:23 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] 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[(_at_)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[(_at_)n=(($loop-variable * 2) - 2)]/@xml:id,
      'f_'),'_',' ')"/>
</xsl:when>

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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~-- 




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>