Subject: Re: [xsl] multiple range expansion From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Tue, 23 Jun 2009 08:05:05 -0400 |
I got the concept and converted successfully. Instead of for-each i have used for to get spaces between ids.
But one place i am unable to remove. Please help to achieve this.
Input:
<cross-ref>[<cr refid="MEP_L_bib5">5</cr>-<cr refid="MEP_L_bib7">7</cr>, <cr refid="MEP_L_bib21">21</cr>-<cr refid="MEP_L_bib24">24</cr>]</cross-ref>
correct output: <cross-refs refid="bib5 bib6 bib7 bib21 bib22 bib23 bib24">[5-7, 21-24]</cross-refs>
Output from modified XSL: <cross-refs refid="bib5 bib6 bib7bib21 bib22 bib23 bib24">[5-7, 21-24]</cross-refs>
Modified XSL code: <xsl:analyze-string select="." regex="(\d+)(\s*-\s*(\d+))?"> <xsl:matching-substring> <xsl:value-of select="for $i in xs:integer(regex-group(1)) to (if(regex-group(3)) then xs:integer(regex-group(3)) else xs:integer(regex-group(1))) return concat('bib', $i)"/>
Please suggest. bib7 and bib21 has to be separated.
-- Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] multiple range expansion, Ganesh Babu N | Thread | [xsl] Xpath errors in XML to XML tr, Catherine Pouncett |
Re: [xsl] xsl-url -- passing xsl:va, Hermann Stamm-Wilbra | Date | [xsl] Calling a Java extension from, Blaine McNutt (rbmcn |
Month |