[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
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: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.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.
-Jen
[xsl] help with an 'or'
Subject: [xsl] help with an 'or' From: Jennifer Pollard <jp337@xxxxxxxxx> Date: Tue, 25 Nov 2008 13:02:11 +0000 |
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.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.
-Jen
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Calling all XSLT developers: , Diane Mueller | Thread | re: [xsl] help with an 'or', Vladimir Nesterovsky |
[xsl] layered lists, Szabo, Patrick (LNG- | Date | [xsl] Grouping based on element con, Ganesh Babu N |
Month |
Keywords