xsl-list
[Top] [All Lists]

Re: [xsl] how find out end position using 'for' loop

2011-06-14 00:25:41
Try replacing: ']+'
with: if ($i != $end) then ']+' else ']'

-Brandon :)


On Tue, Jun 14, 2011 at 12:47 AM, JS Rawat <jrawat(_at_)aptaracorp(_dot_)com> 
wrote:
Hi Everybody,
Have anyone any idea about the below problem. I want + sign between two 
RefArray (RefArray[11] + RefArray[12]) but not in the last (RefArray[12]+ 
RefArray[13]+ should be RefArray[12]+ RefArray[13]).

Input
<link class="bibcit" rid="FileName_bib11">11&#x2013;13</link>

XSLT

<xsl:template match="link">
 <xsl:choose>
 <xsl:when test="@class='bibcit'">
    <xsl:variable name="bibtext" select="."/>
    <xsl:choose>
     <xsl:when test="contains($bibtext, '&#x2013;') and 
substring-before($bibtext,'&#x2013;') castable as xs:integer">
       <xsl:variable name="start" 
select="xs:integer(substring-before($bibtext,'&#x2013;'))"/>
       <xsl:variable name="end" 
select="xs:integer(substring-after($bibtext,'&#x2013;'))"/>
       <a class="bibcit" href="references.htm#{substring-after(@rid,'_')}" 
onmouseout="startTimeout()">
        <xsl:attribute name="onmouseover">refpopup('REF',<xsl:value-of 
select="for $i in $start to $end return 
concat('RefArray[',$i,']+')"/>)</xsl:attribute><xsl:apply-templates/></a>
     </xsl:when>
    </xsl:choose>
  </xsl:when>
 </xsl:choose>
</xsl:template>

OUTPUT
<a class="bibcit" href="references.htm#bib11" onmouseout="startTimeout()" 
onmouseover="refpopup('REF',RefArray[11]+ RefArray[12]+ 
RefArray[13]+)">11–13</a>


Desired OUTPUT
<a class="bibcit" href="references.htm#bib11" onmouseout="startTimeout()" 
onmouseover="refpopup('REF',RefArray[11]+ RefArray[12]+ 
RefArray[13])">11–13</a>

Thanks in advance.

...JSR



--~------------------------------------------------------------------
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>
--~--