XSL: store 2 strings into a variable and then loop through them

I have this string "2107240708-09" that is stored in a variable.
I want to build into 2 values & build the 2nd instance by replacing the last 2 characters that's before the "-" with what's after the "-" (i.e -  2107240708 & 2107240709 and store into variable.
then i want to loop throw both instances.

can this be done?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gertone (Geert Bormans)Information ArchitectCommented:
Overall this is a pretty vague task description

about the string processing,
this can be done using some substringing
- pull off the part after the '-' with substring after
- put the substring-before in a variable
- take the last two characters off the new variable, replace with the substring after and put in new variable

Now the looping part is rally vague.
Just repaet a specific action for both variables... is that not enough?
Gertone (Geert Bormans)Information ArchitectCommented:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    <xsl:variable name="src" select="'2107240708-09'"/>
    <xsl:template match="/">
        <xsl:variable name="suffix" select="substring-after($src, '-')"/>
        <xsl:variable name="res1" select="substring-before($src, '-')"/>
        <xsl:variable name="res2" select="concat(substring($res1, 1, string-length($res1) - string-length($suffix)), $suffix)"/>
        <xsl:value-of select="$res1"/>
         <xsl:value-of select="$res2"/>

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.