Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

How to get the previous element in a sorted for-each loop

Avatar of pnr_dk
pnr_dk asked on
Web Languages and StandardsXML
25 Comments1 Solution550 ViewsLast Modified:
I need to access the previous element in my sorted for-each loop. It is no problem if I don’t use sorting then it works fine.


                <ShortDescription>Modul 4</ShortDescription>
                <Number>204 Teo</Number>
                <Name>et eller andet</Name>
                <BuildingDescription>stort hus</BuildingDescription>

<!--Getting data-->
          <xsl:variable name="skema" select="/Result/Timetable/TimetableEvent[generate-id(.) = generate-id(key('t', StartTime))]"></xsl:variable>

<!-- loop -->
    <xsl:for-each select="$skema[(number(substring-before(StartTime,':'))*100+number(substring-after(StartTime,':'))) > 799]">
                <xsl:sort select="number(substring-before(StartTime,':'))*100+number(substring-after(StartTime,':'))" data-type="number" order="ascending"/>

<!-- current endtime -->
<xsl:value-of select="EndTime"/> -

<!-- *** previous starttime, this isn't working *** -->
<xsl:value-of select="./preceding-sibling::node()[1]/StartTime"></xsl:value-of> 


Thanks in advance!
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)Flag of Belgium imageInformation Architect
This problem has been solved!
Unlock 1 Answer and 25 Comments.
See Answers