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

pnr_dk
pnr_dk used Ask the Experts™
on
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.

Example:

<Timetable>
  <Result>
        .....
        </TimetableEvent>
        <TimetableEvent>
            <Date>2010-06-15</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>2</WeekdayNumber>
            <Weekday>Tirsdag</Weekday>
            <LectureNumber>6</LectureNumber>
            <StartTime>13:30</StartTime>
            <EndTime>14:15</EndTime>
            <Subject>
                <SubjectName>63040</SubjectName>
                <Level>-</Level>
                <ShortDescription>Modul 4</ShortDescription>
                <Description>Beskrivelse</Description>
            </Subject>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>beskrivelse</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>204 Teo</Number>
                <ShortDescription>kort...</ShortDescription>
                <Name>et eller andet</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>hus</BuildingNumber>
                <BuildingDescription>stort hus</BuildingDescription>
            </Room>
        </TimetableEvent>
        <TimetableEvent>
        .....
  </Result>
</Timetable>

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

...

Open in new window


Thanks in advance!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Gertone (Geert Bormans)Information Architect
Top Expert 2006

Commented:
well, preceding-sibling works (as all axis), on the document order, not on the intermediate sorted nodeset
So you example can not work.

As soon as you need that, you basically have two options

- have a pipeline of two transformation. In the first transform you sort, in the second you can use preceding-sibling to get what you want

- make the sort in a variable an use your preceding-sibling trick on iterating over the sorted nodeset in the variable
This however only works if
+ in XSLT1 you have a processor that can transform the Result Tree Fragment in the variable into a nodeset (nodeset extension). For this it is important to know which processor you use: msxml, xalan and saxon all support tjis extension, be it in different manners. Your Stylesheet now is processor dependent
+ in XSLT2, regardless of the processor (RTF no longer exists there, all are "sequences")

- if none of the above are an option, here is a naieve approach, which I don't recommend because of its N-square behaviour

example XML
<test>
    <foo bar="a">aaa</foo>
    <foo bar="c">ccc</foo>
    <foo bar="b">bbb</foo>
</test>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">
<xsl:output indent="yes"/>
    <xsl:template match="test">
    <test>
        <xsl:for-each select="foo">
            <xsl:sort select="@bar"/>
            <xsl:variable name="required-position" select="position() - 1"/>
            <foo>
                <xsl:attribute name="previous-bar">
                    <xsl:for-each select="../foo">
                        <xsl:sort select="@bar"/>
                        <xsl:if test="position() = $required-position">
                            <xsl:value-of select="@bar"/>
                        </xsl:if>
                    </xsl:for-each>
                </xsl:attribute>
                <xsl:value-of select="."/>
            </foo>
        </xsl:for-each>
    </test>
</xsl:template>  
</xsl:stylesheet>

Open in new window

Author

Commented:
Thanks very much for your reply!

Are you suggesting that I shall make a new sorted list of elements, and the iterate throw that.
I have tried the following, but can't make it work

Ex:



<xsl:attribute name="sortedlist">
                <test>
                    <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"/>
                        <xsl:copy-of select="."/>
                    </xsl:for-each>
                </test>
            </xsl:attribute>


<xsl:for-each select="$sortedlist">

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

...

Open in new window

Gertone (Geert Bormans)Information Architect
Top Expert 2006

Commented:
What you have implemented is what I have listed as the second option, but please note:
This will only work in XSLT2
In XSLT1 $sortedList is what is called a "Result Tree Fragment" and can not be accessed using XPath
For that you need to convert it into a node-set with an extension function
To make it work in a processor that supports exslt
you need to add this namespace declaration in the stylesheet element
xmlns:exsl="http://exslt.org/common"
and use the node-set function
<xsl:for-each select="exsl:node-set($sortedlist)">
and then it works
but only on Xalan, Saxon and 4suite support it
(http://www.exslt.org/exsl/functions/node-set/index.html)
microsoft has its own implementation of it, so if you use a microsoft processor
you need this namespace declaration
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
and use
<xsl:for-each select="msxsl:node-set($sortedlist)">

so try to figure out what your processor is and try one of the above suggestions
Announcing the Winners!

The results are in for the 15th Annual Expert Awards! Congratulations to the winners, and thank you to everyone who participated in the nominations. We are so grateful for the valuable contributions experts make on a daily basis. Click to read more about this year’s recipients!

Author

Commented:
Once again thaks for your reply!
I think I am using a Microsoft processor (using it in Visual Studio). I have tried what you suggested, but it isn't working.
I have used a variable insted of an attribute (the attribute generates an error). Now I am not getting any errors, but there isn't any elements in the sortedlist.

<xsl:variable name="temp">
                <test>
                    <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"/>
                        <xsl:copy-of select="."/>
                    </xsl:for-each>
                </test>
            </xsl:variable>

   <xsl:for-each select="msxsl:node-set(@temp)">
            test <br/>
        </xsl:for-each>

        how many?: <xsl:value-of select="count(msxsl:node-set(@temp))"/>

Open in new window

Gertone (Geert Bormans)Information Architect
Top Expert 2006

Commented:
msxsl:node-set(@temp)

should be

msxsl:node-set($temp)
Gertone (Geert Bormans)Information Architect
Top Expert 2006

Commented:
and yes, you are using msxml

did you add the namespace declaration?

Author

Commented:
Thanks again :-)
The only way I can make it work is to copy every node like this, isn't there an easyer way?


<xsl:variable name="temp">
                <Result>
                    <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"/>
                        <Timetable>
                            <StartTime>
                                <xsl:value-of select="StartTime"/>
                            </StartTime>
                        </Timetable>
                    </xsl:for-each>
                </Result>
            </xsl:variable>

Open in new window

Gertone (Geert Bormans)Information Architect
Top Expert 2006

Commented:
that is exactly the point, you copy every node through a for-each,
then make this Result Tree Fragment a node-set by using the node-set() function,
so you can use XPath on it
I don't consider that not easy

You could change this
                            <StartTime>
                                <xsl:value-of select="StartTime"/>
                            </StartTime>

into
<xsl:copy-of select="StartTime"/>

and I am not certein you need the <TimeTable> elements containing each StartTime node

Author

Commented:
Sorry for long responsetime!! I can't make it work as i should. please take a look at my code, it renders start and endtime as it shall, but alle all the others parameters is missing. what am I doing wrong:


<xsl:template match="/">
     .....

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

            <xsl:variable name="temp">
                <Result>
                    <Timetable>

                        <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"/>
                            <TimeTableEvent>
                                <xsl:copy-of select="StartTime"/>
                                <xsl:copy-of select="EndTime"/>
                                <xsl:copy-of select="Weekday"/>
                                <xsl:copy-of select="Comment"/>
                                <xsl:copy-of select="Subject/ShortDescription"/>
                                <xsl:copy-of select="Teacher/Initials"/>
                                <xsl:copy-of select="Room/Number"/>
                                <xsl:copy-of select="Activity/ShortDescription"/>
                            </TimeTableEvent>
                    </xsl:for-each>
                    </Timetable>

                </Result>
            </xsl:variable> 

 <xsl:for-each select="msxsl:node-set($temp)/Result/Timetable/TimeTableEvent">
                <xsl:sort select="number(substring-before(StartTime,':'))*100+number(substring-after(StartTime,':'))" data-type="number" order="ascending"/>
                <xsl:variable name="time" select="StartTime"/>
                <xsl:variable name="omregnettid" select="number(substring-before($time,':'))*100+number(substring-after($time,':'))"></xsl:variable>
                    
                <tr>
                    <td align="right" style="border-bottom: black 1px solid; border-right: black 1px solid;">
                            <xsl:value-of select="StartTime"/> - <xsl:value-of select="EndTime"/> - 
                            
                            <xsl:if test="position() != 1">
                                <xsl:value-of select="$skema/node()[position() = (position()-1)]/StartTime"></xsl:value-of>
                            </xsl:if>
                </td>
                    <td height="30" width="110px" style="border-bottom: 1px solid black; border-right: 1px solid black;">
                        <xsl:call-template name="timeRender">
                            <xsl:with-param name="time" select="$time"/>
                            <xsl:with-param name="day" select="'Mandag'"/>
                        </xsl:call-template>
                    </td>
                    <td width="110" height="30" style="border-bottom: black 1px solid; border-right: black 1px solid;">
                        <xsl:call-template name="timeRender">
                            <xsl:with-param name="time" select="$time"/>
                            <xsl:with-param name="day" select="'Tirsdag'"/>
                        </xsl:call-template>                    
                    </td>
                    <td width="110" height="30" style="border-bottom: black 1px solid; border-right: black 1px solid;">
                        <xsl:call-template name="timeRender">
                            <xsl:with-param name="time" select="$time"/>
                            <xsl:with-param name="day" select="'Onsdag'"/>
                        </xsl:call-template>
                    </td>
                    <td width="110" height="30" style="border-bottom: black 1px solid; border-right: black 1px solid;">
                        <xsl:call-template name="timeRender">
                            <xsl:with-param name="time" select="$time"/>
                            <xsl:with-param name="day" select="'Torsdag'"/>
                        </xsl:call-template>
                    </td>
                    <td width="110" height="30" style="border-bottom: black 1px solid; border-right: black 1px solid;">
                        <xsl:call-template name="timeRender">
                            <xsl:with-param name="time" select="$time"/>
                            <xsl:with-param name="day" select="'Fredag'"/>
                        </xsl:call-template>
                    </td>
                </tr>
                
                </xsl:if>

            </xsl:for-each>
    </xsl:template>
 <xsl:template name="timeRender">
        <xsl:param name="time"/>
        <xsl:param name="day"/>
        
        <xsl:value-of select="/Result/Timetable/TimetableEvent[StartTime = $time and normalize-space(Weekday)=$day]/Comment"/>
        <br/>
        <xsl:value-of select="/Result/Timetable/TimetableEvent[StartTime = $time and normalize-space(Weekday)=$day]/ShortDescription"/>
        <br/>
        <xsl:value-of select="/Result/Timetable/TimetableEvent[StartTime = $time and normalize-space(Weekday)=$day]/Initials"/>
        <br/>
        <xsl:value-of select="/Result/Timetable/TimetableEvent[StartTime = $time and normalize-space(Weekday)=$day]/Number"/>
        <br/>
        <xsl:value-of select="/Result/Timetable/TimetableEvent[StartTime = $time and normalize-space(Weekday)=$day]/ShortDescription"/>
        <br/>
    </xsl:template>

Open in new window

Gertone (Geert Bormans)Information Architect
Top Expert 2006

Commented:
I need more of the XML source,
and I need the full XSLT in order to have a look at the debugging
Please attach

Author

Commented:
Thanks again very much for your reply!
Here is all the code, first the XML and after that the XSLT:

<TimetableEvent>
            <Date>2010-06-15</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>2</WeekdayNumber>
            <Weekday>Tirsdag</Weekday>
            <LectureNumber>4</LectureNumber>
            <StartTime>11:00</StartTime>
            <EndTime>11:45</EndTime>
            <ExaminationEvent>N</ExaminationEvent>
            <Planner>GVJ</Planner>
            <RevisionDate>2008-09-08</RevisionDate>
            <Form>UV</Form>
            <FormDescription>Undervisning</FormDescription>
            <TimetableEventLabel>Vejledning</TimetableEventLabel>
            <Subject>
                <SubjectName>63040</SubjectName>
                <Level>-</Level>
                <ShortDescription>Modul 4</ShortDescription>
                <Description>Rehabilitering og habilitering som muliggør aktivitet og deltagelse. Genoptræning og behandling I</Description>
            </Subject>
            <Teacher>
                <Initials>IVA</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Ingrid Vej</Firstname>
                <Surname>Andersen</Surname>
                <Role>UV</Role>
                <Department>VITA</Department>
            </Teacher>
            <Teacher>
                <Initials>AMK</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Anne-Mette</Firstname>
                <Surname>Kjær</Surname>
                <Role>UV</Role>
                <Department>VITA</Department>
            </Teacher>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>E75 start start august 2009</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>204 Teo</Number>
                <ShortDescription>7500-A204 Teori</ShortDescription>
                <Name>Teorilokale i bygning A</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>7500 - A</BuildingNumber>
                <BuildingDescription>Hovedbygningen Holstebro</BuildingDescription>
            </Room>
        </TimetableEvent>
        <TimetableEvent>
            <Date>2010-06-15</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>2</WeekdayNumber>
            <Weekday>Tirsdag</Weekday>
            <LectureNumber>3</LectureNumber>
            <StartTime>10:00</StartTime>
            <EndTime>10:45</EndTime>
            <ExaminationEvent>N</ExaminationEvent>
            <Planner>GVJ</Planner>
            <RevisionDate>2008-09-08</RevisionDate>
            <Form>UV</Form>
            <FormDescription>Undervisning</FormDescription>
            <TimetableEventLabel>Vejledning</TimetableEventLabel>
            <Subject>
                <SubjectName>63040</SubjectName>
                <Level>-</Level>
                <ShortDescription>Modul 4</ShortDescription>
                <Description>Rehabilitering og habilitering som muliggør aktivitet og deltagelse. Genoptræning og behandling I</Description>
            </Subject>
            <Teacher>
                <Initials>IVA</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Ingrid Vej</Firstname>
                <Surname>Andersen</Surname>
                <Role>UV</Role>
                <Department>VITA</Department>
            </Teacher>
            <Teacher>
                <Initials>AMK</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Anne-Mette</Firstname>
                <Surname>Kjær</Surname>
                <Role>UV</Role>
                <Department>VITA</Department>
            </Teacher>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>E75 start start august 2009</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>204 Teo</Number>
                <ShortDescription>7500-A204 Teori</ShortDescription>
                <Name>Teorilokale i bygning A</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>7500 - A</BuildingNumber>
                <BuildingDescription>Hovedbygningen Holstebro</BuildingDescription>
            </Room>
        </TimetableEvent>
        <TimetableEvent>
            <Date>2010-06-15</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>2</WeekdayNumber>
            <Weekday>Tirsdag</Weekday>
            <LectureNumber>2</LectureNumber>
            <StartTime>09:00</StartTime>
            <EndTime>09:45</EndTime>
            <ExaminationEvent>N</ExaminationEvent>
            <Planner>GVJ</Planner>
            <RevisionDate>2008-09-08</RevisionDate>
            <Form>UV</Form>
            <FormDescription>Undervisning</FormDescription>
            <TimetableEventLabel>Vejledning</TimetableEventLabel>
            <Subject>
                <SubjectName>63040</SubjectName>
                <Level>-</Level>
                <ShortDescription>Modul 4</ShortDescription>
                <Description>Rehabilitering og habilitering som muliggør aktivitet og deltagelse. Genoptræning og behandling I</Description>
            </Subject>
            <Teacher>
                <Initials>IVA</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Ingrid Vej</Firstname>
                <Surname>Andersen</Surname>
                <Role>UV</Role>
                <Department>VITA</Department>
            </Teacher>
            <Teacher>
                <Initials>AMK</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Anne-Mette</Firstname>
                <Surname>Kjær</Surname>
                <Role>UV</Role>
                <Department>VITA</Department>
            </Teacher>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>E75 start start august 2009</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>204 Teo</Number>
                <ShortDescription>7500-A204 Teori</ShortDescription>
                <Name>Teorilokale i bygning A</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>7500 - A</BuildingNumber>
                <BuildingDescription>Hovedbygningen Holstebro</BuildingDescription>
            </Room>
        </TimetableEvent>
        <TimetableEvent>
            <Date>2010-06-15</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>2</WeekdayNumber>
            <Weekday>Tirsdag</Weekday>
            <LectureNumber>1</LectureNumber>
            <StartTime>08:00</StartTime>
            <EndTime>08:45</EndTime>
            <ExaminationEvent>N</ExaminationEvent>
            <Planner>GVJ</Planner>
            <RevisionDate>2008-09-08</RevisionDate>
            <Form>UV</Form>
            <FormDescription>Undervisning</FormDescription>
            <TimetableEventLabel>Vejledning</TimetableEventLabel>
            <Subject>
                <SubjectName>63040</SubjectName>
                <Level>-</Level>
                <ShortDescription>Modul 4</ShortDescription>
                <Description>Rehabilitering og habilitering som muliggør aktivitet og deltagelse. Genoptræning og behandling I</Description>
            </Subject>
            <Teacher>
                <Initials>IVA</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Ingrid Vej</Firstname>
                <Surname>Andersen</Surname>
                <Role>UV</Role>
                <Department>VITA</Department>
            </Teacher>
            <Teacher>
                <Initials>AMK</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Anne-Mette</Firstname>
                <Surname>Kjær</Surname>
                <Role>UV</Role>
                <Department>VITA</Department>
            </Teacher>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>E75 start start august 2009</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>204 Teo</Number>
                <ShortDescription>7500-A204 Teori</ShortDescription>
                <Name>Teorilokale i bygning A</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>7500 - A</BuildingNumber>
                <BuildingDescription>Hovedbygningen Holstebro</BuildingDescription>
            </Room>
        </TimetableEvent>
        <TimetableEvent>
            <Date>2010-06-15</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>2</WeekdayNumber>
            <Weekday>Tirsdag</Weekday>
            <LectureNumber>6</LectureNumber>
            <StartTime>13:30</StartTime>
            <EndTime>14:15</EndTime>
            <ExaminationEvent>N</ExaminationEvent>
            <Planner>GVJ</Planner>
            <RevisionDate>2008-09-08</RevisionDate>
            <Form>UV</Form>
            <FormDescription>Undervisning</FormDescription>
            <TimetableEventLabel>Holdets time</TimetableEventLabel>
            <Subject>
                <SubjectName>63040</SubjectName>
                <Level>-</Level>
                <ShortDescription>Modul 4</ShortDescription>
                <Description>Rehabilitering og habilitering som muliggør aktivitet og deltagelse. Genoptræning og behandling I</Description>
            </Subject>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>E75 start start august 2009</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>204 Teo</Number>
                <ShortDescription>7500-A204 Teori</ShortDescription>
                <Name>Teorilokale i bygning A</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>7500 - A</BuildingNumber>
                <BuildingDescription>Hovedbygningen Holstebro</BuildingDescription>
            </Room>
        </TimetableEvent>
        <TimetableEvent>
            <Date>2010-06-15</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>2</WeekdayNumber>
            <Weekday>Tirsdag</Weekday>
            <LectureNumber>9</LectureNumber>
            <StartTime>16:30</StartTime>
            <EndTime>17:15</EndTime>
            <ExaminationEvent>N</ExaminationEvent>
            <Planner>GVJ</Planner>
            <RevisionDate>2008-09-08</RevisionDate>
            <Form>UV</Form>
            <FormDescription>Undervisning</FormDescription>
            <TimetableEventLabel>Medicin</TimetableEventLabel>
            <Subject>
                <SubjectName>63040</SubjectName>
                <Level>-</Level>
                <ShortDescription>Modul 4</ShortDescription>
                <Description>Rehabilitering og habilitering som muliggør aktivitet og deltagelse. Genoptræning og behandling I</Description>
            </Subject>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>E75 start start august 2009</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>204 Teo</Number>
                <ShortDescription>7500-A204 Teori</ShortDescription>
                <Name>Teorilokale i bygning A</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>7500 - A</BuildingNumber>
                <BuildingDescription>Hovedbygningen Holstebro</BuildingDescription>
            </Room>
        </TimetableEvent>
        <TimetableEvent>
            <Date>2010-06-15</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>2</WeekdayNumber>
            <Weekday>Tirsdag</Weekday>
            <LectureNumber>8</LectureNumber>
            <StartTime>15:30</StartTime>
            <EndTime>16:15</EndTime>
            <ExaminationEvent>N</ExaminationEvent>
            <Planner>GVJ</Planner>
            <RevisionDate>2008-09-08</RevisionDate>
            <Form>UV</Form>
            <FormDescription>Undervisning</FormDescription>
            <TimetableEventLabel>Medicin</TimetableEventLabel>
            <Subject>
                <SubjectName>63040</SubjectName>
                <Level>-</Level>
                <ShortDescription>Modul 4</ShortDescription>
                <Description>Rehabilitering og habilitering som muliggør aktivitet og deltagelse. Genoptræning og behandling I</Description>
            </Subject>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>E75 start start august 2009</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>204 Teo</Number>
                <ShortDescription>7500-A204 Teori</ShortDescription>
                <Name>Teorilokale i bygning A</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>7500 - A</BuildingNumber>
                <BuildingDescription>Hovedbygningen Holstebro</BuildingDescription>
            </Room>
        </TimetableEvent>
        <TimetableEvent>
            <Date>2010-06-15</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>2</WeekdayNumber>
            <Weekday>Tirsdag</Weekday>
            <LectureNumber>5</LectureNumber>
            <StartTime>12:30</StartTime>
            <EndTime>13:15</EndTime>
            <ExaminationEvent>N</ExaminationEvent>
            <Planner>GVJ</Planner>
            <RevisionDate>2008-09-08</RevisionDate>
            <Form>UV</Form>
            <FormDescription>Undervisning</FormDescription>
            <TimetableEventLabel>Vejledning</TimetableEventLabel>
            <Subject>
                <SubjectName>63040</SubjectName>
                <Level>-</Level>
                <ShortDescription>Modul 4</ShortDescription>
                <Description>Rehabilitering og habilitering som muliggør aktivitet og deltagelse. Genoptræning og behandling I</Description>
            </Subject>
            <Teacher>
                <Initials>IVA</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Ingrid Vej</Firstname>
                <Surname>Andersen</Surname>
                <Role>UV</Role>
                <Department>VITA</Department>
            </Teacher>
            <Teacher>
                <Initials>AMK</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Anne-Mette</Firstname>
                <Surname>Kjær</Surname>
                <Role>UV</Role>
                <Department>VITA</Department>
            </Teacher>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>E75 start start august 2009</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>204 Teo</Number>
                <ShortDescription>7500-A204 Teori</ShortDescription>
                <Name>Teorilokale i bygning A</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>7500 - A</BuildingNumber>
                <BuildingDescription>Hovedbygningen Holstebro</BuildingDescription>
            </Room>
        </TimetableEvent>
        <TimetableEvent>
            <Date>2010-06-17</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>4</WeekdayNumber>
            <Weekday>Torsdag</Weekday>
            <LectureNumber>5</LectureNumber>
            <StartTime>12:30</StartTime>
            <EndTime>13:15</EndTime>
            <ExaminationEvent>N</ExaminationEvent>
            <Planner>GVJ</Planner>
            <RevisionDate>2008-09-08</RevisionDate>
            <Form>UV</Form>
            <FormDescription>Undervisning</FormDescription>
            <TimetableEventLabel>.</TimetableEventLabel>
            <Subject>
                <SubjectName>63046</SubjectName>
                <Level>-</Level>
                <ShortDescription>M4 Fysiologi</ShortDescription>
                <Description>M04 Fysiologi</Description>
            </Subject>
            <Teacher>
                <Initials>AMJ</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Anders Møller</Firstname>
                <Surname>Jensen</Surname>
                <Role>UV</Role>
                <Department>MV</Department>
            </Teacher>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>E75 start start august 2009</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>340 Teo</Number>
                <ShortDescription>7500-A340 Teori</ShortDescription>
                <Name>Teorilokale i bygning A</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>7500 - A</BuildingNumber>
                <BuildingDescription>Hovedbygningen Holstebro</BuildingDescription>
            </Room>
        </TimetableEvent>
        <TimetableEvent>
            <Date>2010-06-17</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>4</WeekdayNumber>
            <Weekday>Torsdag</Weekday>
            <LectureNumber>4</LectureNumber>
            <StartTime>11:00</StartTime>
            <EndTime>11:45</EndTime>
            <ExaminationEvent>N</ExaminationEvent>
            <Planner>GVJ</Planner>
            <RevisionDate>2008-09-08</RevisionDate>
            <Form>UV</Form>
            <FormDescription>Undervisning</FormDescription>
            <TimetableEventLabel>.</TimetableEventLabel>
            <Subject>
                <SubjectName>63046</SubjectName>
                <Level>-</Level>
                <ShortDescription>M4 Fysiologi</ShortDescription>
                <Description>M04 Fysiologi</Description>
            </Subject>
            <Teacher>
                <Initials>AMJ</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Anders Møller</Firstname>
                <Surname>Jensen</Surname>
                <Role>UV</Role>
                <Department>MV</Department>
            </Teacher>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>E75 start start august 2009</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>340 Teo</Number>
                <ShortDescription>7500-A340 Teori</ShortDescription>
                <Name>Teorilokale i bygning A</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>7500 - A</BuildingNumber>
                <BuildingDescription>Hovedbygningen Holstebro</BuildingDescription>
            </Room>
        </TimetableEvent>
        <TimetableEvent>
            <Date>2010-06-17</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>4</WeekdayNumber>
            <Weekday>Torsdag</Weekday>
            <LectureNumber>3</LectureNumber>
            <StartTime>10:00</StartTime>
            <EndTime>10:45</EndTime>
            <ExaminationEvent>N</ExaminationEvent>
            <Planner>GVJ</Planner>
            <RevisionDate>2008-09-08</RevisionDate>
            <Form>UV</Form>
            <FormDescription>Undervisning</FormDescription>
            <TimetableEventLabel>.</TimetableEventLabel>
            <Subject>
                <SubjectName>63046</SubjectName>
                <Level>-</Level>
                <ShortDescription>M4 Fysiologi</ShortDescription>
                <Description>M04 Fysiologi</Description>
            </Subject>
            <Teacher>
                <Initials>AMJ</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Anders Møller</Firstname>
                <Surname>Jensen</Surname>
                <Role>UV</Role>
                <Department>MV</Department>
            </Teacher>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>E75 start start august 2009</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>340 Teo</Number>
                <ShortDescription>7500-A340 Teori</ShortDescription>
                <Name>Teorilokale i bygning A</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>7500 - A</BuildingNumber>
                <BuildingDescription>Hovedbygningen Holstebro</BuildingDescription>
            </Room>
        </TimetableEvent>
        <TimetableEvent>
            <Date>2010-06-17</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>4</WeekdayNumber>
            <Weekday>Torsdag</Weekday>
            <LectureNumber>2</LectureNumber>
            <StartTime>09:00</StartTime>
            <EndTime>09:45</EndTime>
            <ExaminationEvent>N</ExaminationEvent>
            <Planner>GVJ</Planner>
            <RevisionDate>2008-09-08</RevisionDate>
            <Form>UV</Form>
            <FormDescription>Undervisning</FormDescription>
            <TimetableEventLabel>.</TimetableEventLabel>
            <Subject>
                <SubjectName>63046</SubjectName>
                <Level>-</Level>
                <ShortDescription>M4 Fysiologi</ShortDescription>
                <Description>M04 Fysiologi</Description>
            </Subject>
            <Teacher>
                <Initials>AMJ</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Anders Møller</Firstname>
                <Surname>Jensen</Surname>
                <Role>UV</Role>
                <Department>MV</Department>
            </Teacher>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>E75 start start august 2009</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>340 Teo</Number>
                <ShortDescription>7500-A340 Teori</ShortDescription>
                <Name>Teorilokale i bygning A</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>7500 - A</BuildingNumber>
                <BuildingDescription>Hovedbygningen Holstebro</BuildingDescription>
            </Room>
        </TimetableEvent>
        <TimetableEvent>
            <Date>2010-06-14</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>1</WeekdayNumber>
            <Weekday>Mandag </Weekday>
            <LectureNumber>6</LectureNumber>
            <StartTime>13:30</StartTime>
            <EndTime>14:15</EndTime>
            <ExaminationEvent>N</ExaminationEvent>
            <Planner>GVJ</Planner>
            <RevisionDate>2008-09-08</RevisionDate>
            <Form>UV</Form>
            <FormDescription>Undervisning</FormDescription>
            <TimetableEventLabel>.</TimetableEventLabel>
            <Subject>
                <SubjectName>63046</SubjectName>
                <Level>-</Level>
                <ShortDescription>M4 Fysiologi</ShortDescription>
                <Description>M04 Fysiologi</Description>
            </Subject>
            <Teacher>
                <Initials>AMJ</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Anders Møller</Firstname>
                <Surname>Jensen</Surname>
                <Role>UV</Role>
                <Department>MV</Department>
            </Teacher>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>E75 start start august 2009</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>340 Teo</Number>
                <ShortDescription>7500-A340 Teori</ShortDescription>
                <Name>Teorilokale i bygning A</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>7500 - A</BuildingNumber>
                <BuildingDescription>Hovedbygningen Holstebro</BuildingDescription>
            </Room>
        </TimetableEvent>
        <TimetableEvent>
            <Date>2010-06-14</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>1</WeekdayNumber>
            <Weekday>Mandag </Weekday>
            <LectureNumber>5</LectureNumber>
            <StartTime>12:30</StartTime>
            <EndTime>13:15</EndTime>
            <ExaminationEvent>N</ExaminationEvent>
            <Planner>GVJ</Planner>
            <RevisionDate>2008-09-08</RevisionDate>
            <Form>UV</Form>
            <FormDescription>Undervisning</FormDescription>
            <TimetableEventLabel>.</TimetableEventLabel>
            <Subject>
                <SubjectName>63046</SubjectName>
                <Level>-</Level>
                <ShortDescription>M4 Fysiologi</ShortDescription>
                <Description>M04 Fysiologi</Description>
            </Subject>
            <Teacher>
                <Initials>AMJ</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Anders Møller</Firstname>
                <Surname>Jensen</Surname>
                <Role>UV</Role>
                <Department>MV</Department>
            </Teacher>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>E75 start start august 2009</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>340 Teo</Number>
                <ShortDescription>7500-A340 Teori</ShortDescription>
                <Name>Teorilokale i bygning A</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>7500 - A</BuildingNumber>
                <BuildingDescription>Hovedbygningen Holstebro</BuildingDescription>
            </Room>
        </TimetableEvent>
        <TimetableEvent>
            <Date>2010-06-14</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>1</WeekdayNumber>
            <Weekday>Mandag </Weekday>
            <LectureNumber>4</LectureNumber>
            <StartTime>11:00</StartTime>
            <EndTime>11:45</EndTime>
            <ExaminationEvent>N</ExaminationEvent>
            <Planner>GVJ</Planner>
            <RevisionDate>2008-09-08</RevisionDate>
            <Form>UV</Form>
            <FormDescription>Undervisning</FormDescription>
            <TimetableEventLabel>.</TimetableEventLabel>
            <Subject>
                <SubjectName>63046</SubjectName>
                <Level>-</Level>
                <ShortDescription>M4 Fysiologi</ShortDescription>
                <Description>M04 Fysiologi</Description>
            </Subject>
            <Teacher>
                <Initials>AMJ</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Anders Møller</Firstname>
                <Surname>Jensen</Surname>
                <Role>UV</Role>
                <Department>MV</Department>
            </Teacher>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>E75 start start august 2009</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>340 Teo</Number>
                <ShortDescription>7500-A340 Teori</ShortDescription>
                <Name>Teorilokale i bygning A</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>7500 - A</BuildingNumber>
                <BuildingDescription>Hovedbygningen Holstebro</BuildingDescription>
            </Room>
        </TimetableEvent>
        <TimetableEvent>
            <Date>2010-06-17</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>4</WeekdayNumber>
            <Weekday>Torsdag</Weekday>
            <LectureNumber>6</LectureNumber>
            <StartTime>13:30</StartTime>
            <EndTime>14:15</EndTime>
            <ExaminationEvent>N</ExaminationEvent>
            <Planner>GVJ</Planner>
            <RevisionDate>2008-09-08</RevisionDate>
            <Form>UV</Form>
            <FormDescription>Undervisning</FormDescription>
            <TimetableEventLabel>.</TimetableEventLabel>
            <Subject>
                <SubjectName>63046</SubjectName>
                <Level>-</Level>
                <ShortDescription>M4 Fysiologi</ShortDescription>
                <Description>M04 Fysiologi</Description>
            </Subject>
            <Teacher>
                <Initials>AMJ</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Anders Møller</Firstname>
                <Surname>Jensen</Surname>
                <Role>UV</Role>
                <Department>MV</Department>
            </Teacher>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>E75 start start august 2009</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>340 Teo</Number>
                <ShortDescription>7500-A340 Teori</ShortDescription>
                <Name>Teorilokale i bygning A</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>7500 - A</BuildingNumber>
                <BuildingDescription>Hovedbygningen Holstebro</BuildingDescription>
            </Room>
        </TimetableEvent>
        <TimetableEvent>
            <Date>2010-06-14</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>1</WeekdayNumber>
            <Weekday>Mandag </Weekday>
            <LectureNumber>2</LectureNumber>
            <StartTime>09:00</StartTime>
            <EndTime>09:45</EndTime>
            <ExaminationEvent>N</ExaminationEvent>
            <Planner>GVJ</Planner>
            <RevisionDate>2008-09-08</RevisionDate>
            <Form>UV</Form>
            <FormDescription>Undervisning</FormDescription>
            <TimetableEventLabel>.</TimetableEventLabel>
            <Subject>
                <SubjectName>63046</SubjectName>
                <Level>-</Level>
                <ShortDescription>M4 Fysiologi</ShortDescription>
                <Description>M04 Fysiologi</Description>
            </Subject>
            <Teacher>
                <Initials>AMJ</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Anders Møller</Firstname>
                <Surname>Jensen</Surname>
                <Role>UV</Role>
                <Department>MV</Department>
            </Teacher>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>E75 start start august 2009</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>340 Teo</Number>
                <ShortDescription>7500-A340 Teori</ShortDescription>
                <Name>Teorilokale i bygning A</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>7500 - A</BuildingNumber>
                <BuildingDescription>Hovedbygningen Holstebro</BuildingDescription>
            </Room>
        </TimetableEvent>
        <TimetableEvent>
            <Date>2010-06-14</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>1</WeekdayNumber>
            <Weekday>Mandag </Weekday>
            <LectureNumber>3</LectureNumber>
            <StartTime>10:00</StartTime>
            <EndTime>10:45</EndTime>
            <ExaminationEvent>N</ExaminationEvent>
            <Planner>GVJ</Planner>
            <RevisionDate>2008-09-08</RevisionDate>
            <Form>UV</Form>
            <FormDescription>Undervisning</FormDescription>
            <TimetableEventLabel>.</TimetableEventLabel>
            <Subject>
                <SubjectName>63046</SubjectName>
                <Level>-</Level>
                <ShortDescription>M4 Fysiologi</ShortDescription>
                <Description>M04 Fysiologi</Description>
            </Subject>
            <Teacher>
                <Initials>AMJ</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Anders Møller</Firstname>
                <Surname>Jensen</Surname>
                <Role>UV</Role>
                <Department>MV</Department>
            </Teacher>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>E75 start start august 2009</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>340 Teo</Number>
                <ShortDescription>7500-A340 Teori</ShortDescription>
                <Name>Teorilokale i bygning A</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>7500 - A</BuildingNumber>
                <BuildingDescription>Hovedbygningen Holstebro</BuildingDescription>
            </Room>
        </TimetableEvent>



 <xsl:output method="html"/>
    <xsl:param name="test"></xsl:param>
    <xsl:key name="t" match="/Result/Timetable/TimetableEvent" use="StartTime"/>
    <xsl:template match="/">
        <xsl:variable name="school" select="ID=/Result[ID=$test]"></xsl:variable>
        her: <xsl.value-of select="$school"></xsl.value-of>

        <table  id="skema" style="font-family: Verdana; font-size:11px; border-top: 1px solid black; border-left: 1px solid black;" width="650" cellspacing="0" >
            <tr style="font-weight:bold; height:20px; background-color:#eee;">
                <td width="100px" style="border-bottom: 1px solid black; border-right: 1px solid black;">
                    Uge <xsl:value-of select="/Result/Timetable/TimetableEvent/WeekNumber"/>
                </td>
                <td width="110px" style="border-bottom: 1px solid black; border-right: 1px solid black;">
                    Mandag<br/>
                    <xsl:call-template name="FormatDate">
                        <xsl:with-param name="DateTime" select="/Result/Timetable/TimetableEvent[WeekdayNumber=1]/Date"/>
                    </xsl:call-template>
                </td>
                <td width="110px" style="border-bottom: 1px solid black; border-right: 1px solid black;">
                    Tirsdag<br/>
                    <xsl:call-template name="FormatDate">
                        <xsl:with-param name="DateTime" select="/Result/Timetable/TimetableEvent[WeekdayNumber=2]/Date"/>
                    </xsl:call-template>

                </td>
                <td width="110px" style="border-bottom: 1px solid black; border-right: 1px solid black;">
                    Onsdag<br/>
                    <xsl:call-template name="FormatDate">
                        <xsl:with-param name="DateTime" select="/Result/Timetable/TimetableEvent[WeekdayNumber=3]/Date"/>
                    </xsl:call-template>
                </td>
                <td width="110px" style="border-bottom: 1px solid black; border-right: 1px solid black;">
                    Torsdag<br/>
                    <xsl:call-template name="FormatDate">
                        <xsl:with-param name="DateTime" select="/Result/Timetable/TimetableEvent[WeekdayNumber=4]/Date"/>
                    </xsl:call-template>
                </td>
                <td width="110px" style="border-bottom: 1px solid black; border-right: 1px solid black;">
                    Fredag<br/> 	<xsl:call-template name="FormatDate">
                        <xsl:with-param name="DateTime" select="/Result/Timetable/TimetableEvent[WeekdayNumber=5]/Date"/>
                    </xsl:call-template>
                </td>
            </tr>
            
            <xsl:variable name="skema" select="/Result/Timetable/TimetableEvent[generate-id(.) = generate-id(key('t', StartTime))]"></xsl:variable>

            <xsl:variable name="morgentid" select="count(/Result/Timetable/TimetableEvent/StartTime[text() = '08:00'])"></xsl:variable>
            <xsl:variable name="resultset" select="$skema[(number(substring-before(StartTime,':'))*100+number(substring-after(StartTime,':'))) > 799]"></xsl:variable>

            <xsl:variable name="temp">
                <Result>
                    <Timetable>

                        <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"/>
                            <TimeTableEvent>
                                <xsl:copy-of select="StartTime"/>
                                <xsl:copy-of select="EndTime"/>
                                <xsl:copy-of select="Weekday"/>
                                <xsl:copy-of select="Comment"/>
                                <xsl:copy-of select="Subject/ShortDescription"/>
                                <xsl:copy-of select="Teacher/Initials"/>
                                <xsl:copy-of select="Room/Number"/>
                                <xsl:copy-of select="Activity/ShortDescription"/>
                            </TimeTableEvent>
                    </xsl:for-each>
                    </Timetable>

                </Result>
            </xsl:variable>

            <xsl:for-each select="msxsl:node-set($temp)/Result/Timetable/TimeTableEvent">
                <xsl:sort select="number(substring-before(StartTime,':'))*100+number(substring-after(StartTime,':'))" data-type="number" order="ascending"/>
                <xsl:variable name="time" select="StartTime"/>
                <xsl:variable name="omregnettid" select="number(substring-before($time,':'))*100+number(substring-after($time,':'))"></xsl:variable>

                <xsl:if test="($morgentid = 0) and (position() = 1) and starts-with(Room/BuildingNumber, '7500')">
                    <tr>
                        <td align="right" style="border-bottom: black 1px solid; border-right: black 1px solid;">08:00 - 08:45</td>
                        <td width="110" height="30" style="border-bottom: black 1px solid; border-right: black 1px solid;">&#160;</td>
                        <td width="110" height="30" style="border-bottom: black 1px solid; border-right: black 1px solid;">&#160;</td>
                        <td width="110" height="30" style="border-bottom: black 1px solid; border-right: black 1px solid;">&#160;</td>
                        <td width="110" height="30" style="border-bottom: black 1px solid; border-right: black 1px solid;">&#160;</td>
                        <td width="110" height="30" style="border-bottom: black 1px solid; border-right: black 1px solid;">&#160;</td>

                    </tr>
                </xsl:if>
                    
                <tr>
                    <td align="right" style="border-bottom: black 1px solid; border-right: black 1px solid;">
                            <xsl:value-of select="StartTime"/> - <xsl:value-of select="EndTime"/>  
                            
                          
                </td>
                    <td height="30" width="110px" style="border-bottom: 1px solid black; border-right: 1px solid black;">
                        <xsl:call-template name="timeRender">
                            <xsl:with-param name="time" select="$time"/>
                            <xsl:with-param name="day" select="'Mandag'"/>
                        </xsl:call-template>
                    </td>
                    <td width="110" height="30" style="border-bottom: black 1px solid; border-right: black 1px solid;">
                        <xsl:call-template name="timeRender">
                            <xsl:with-param name="time" select="$time"/>
                            <xsl:with-param name="day" select="'Tirsdag'"/>
                        </xsl:call-template>                    
                    </td>
                    <td width="110" height="30" style="border-bottom: black 1px solid; border-right: black 1px solid;">
                        <xsl:call-template name="timeRender">
                            <xsl:with-param name="time" select="$time"/>
                            <xsl:with-param name="day" select="'Onsdag'"/>
                        </xsl:call-template>
                    </td>
                    <td width="110" height="30" style="border-bottom: black 1px solid; border-right: black 1px solid;">
                        <xsl:call-template name="timeRender">
                            <xsl:with-param name="time" select="$time"/>
                            <xsl:with-param name="day" select="'Torsdag'"/>
                        </xsl:call-template>
                    </td>
                    <td width="110" height="30" style="border-bottom: black 1px solid; border-right: black 1px solid;">
                        <xsl:call-template name="timeRender">
                            <xsl:with-param name="time" select="$time"/>
                            <xsl:with-param name="day" select="'Fredag'"/>
                        </xsl:call-template>
                    </td>
                </tr>

            </xsl:for-each>
        </table>

       
        
    </xsl:template>


    <xsl:template name="timeRender">
        <xsl:param name="time"/>
        <xsl:param name="day"/>
        
        <xsl:value-of select="/Result/Timetable/TimetableEvent[StartTime = $time and normalize-space(Weekday)=$day]/Comment"/>
        <br/>
        <xsl:value-of select="/Result/Timetable/TimetableEvent[StartTime = $time and normalize-space(Weekday)=$day]/ShortDescription"/>
        <br/>
        <xsl:value-of select="/Result/Timetable/TimetableEvent[StartTime = $time and normalize-space(Weekday)=$day]/Initials"/>
        <br/>
        <xsl:value-of select="/Result/Timetable/TimetableEvent[StartTime = $time and normalize-space(Weekday)=$day]/Number"/>
        <br/>
        <xsl:value-of select="/Result/Timetable/TimetableEvent[StartTime = $time and normalize-space(Weekday)=$day]/ShortDescription"/>
        <br/>
    </xsl:template>

            

    

    <xsl:template name="FormatDate">
        <xsl:param name="DateTime" />
        <!-- new date format 2006-01-14T08:55:22 -->
        <xsl:variable name="year">
            <xsl:value-of select="substring($DateTime,0,5)" />
        </xsl:variable>
        <xsl:variable name="month">
            <xsl:value-of select="substring($DateTime,6,2)" />
        </xsl:variable>
        <xsl:variable name="day">
            <xsl:value-of select="substring($DateTime,9,2)" />
        </xsl:variable>
        <xsl:value-of select="$day"/>-<xsl:value-of select="$month"/>-<xsl:value-of select="$year"/>

    </xsl:template>

Open in new window

Gertone (Geert Bormans)Information Architect
Top Expert 2006

Commented:
I am looking in to this, this morning.
Do you realize that the XML you sent is not wellformed?
An XML document should have one single root, yours has multiple root elements.
Please make sure first your source XML is wellformed
Gertone (Geert Bormans)Information Architect
Top Expert 2006

Commented:
and you do the same with teh XSLT, it is not complete
First thing I want to check is the stylesheet element, to see that you have the namespace correct
But I don't see the stylesheet element

Author

Commented:
I am so sorry, now it should be wellformed:
<Result TimeStamp="2010-06-21T11:00:08">
    <Timetable>
<TimetableEvent>
            <Date>2010-06-15</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>2</WeekdayNumber>
            <Weekday>Tirsdag</Weekday>
            <LectureNumber>4</LectureNumber>
            <StartTime>11:00</StartTime>
            <EndTime>11:45</EndTime>
            <ExaminationEvent>N</ExaminationEvent>
            <Planner>GVJ</Planner>
            <RevisionDate>2008-09-08</RevisionDate>
            <Form>UV</Form>
            <FormDescription>Undervisning</FormDescription>
            <TimetableEventLabel>Vejledning</TimetableEventLabel>
            <Subject>
                <SubjectName>63040</SubjectName>
                <Level>-</Level>
                <ShortDescription>Modul 4</ShortDescription>
                <Description>Rehabilitering og habilitering som muliggør aktivitet og deltagelse. Genoptræning og behandling I</Description>
            </Subject>
            <Teacher>
                <Initials>IVA</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Ingrid Vej</Firstname>
                <Surname>Andersen</Surname>
                <Role>UV</Role>
                <Department>VITA</Department>
            </Teacher>
            <Teacher>
                <Initials>AMK</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Anne-Mette</Firstname>
                <Surname>Kjær</Surname>
                <Role>UV</Role>
                <Department>VITA</Department>
            </Teacher>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>E75 start start august 2009</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>204 Teo</Number>
                <ShortDescription>7500-A204 Teori</ShortDescription>
                <Name>Teorilokale i bygning A</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>7500 - A</BuildingNumber>
                <BuildingDescription>Hovedbygningen Holstebro</BuildingDescription>
            </Room>
        </TimetableEvent>
        <TimetableEvent>
            <Date>2010-06-15</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>2</WeekdayNumber>
            <Weekday>Tirsdag</Weekday>
            <LectureNumber>3</LectureNumber>
            <StartTime>10:00</StartTime>
            <EndTime>10:45</EndTime>
            <ExaminationEvent>N</ExaminationEvent>
            <Planner>GVJ</Planner>
            <RevisionDate>2008-09-08</RevisionDate>
            <Form>UV</Form>
            <FormDescription>Undervisning</FormDescription>
            <TimetableEventLabel>Vejledning</TimetableEventLabel>
            <Subject>
                <SubjectName>63040</SubjectName>
                <Level>-</Level>
                <ShortDescription>Modul 4</ShortDescription>
                <Description>Rehabilitering og habilitering som muliggør aktivitet og deltagelse. Genoptræning og behandling I</Description>
            </Subject>
            <Teacher>
                <Initials>IVA</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Ingrid Vej</Firstname>
                <Surname>Andersen</Surname>
                <Role>UV</Role>
                <Department>VITA</Department>
            </Teacher>
            <Teacher>
                <Initials>AMK</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Anne-Mette</Firstname>
                <Surname>Kjær</Surname>
                <Role>UV</Role>
                <Department>VITA</Department>
            </Teacher>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>E75 start start august 2009</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>204 Teo</Number>
                <ShortDescription>7500-A204 Teori</ShortDescription>
                <Name>Teorilokale i bygning A</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>7500 - A</BuildingNumber>
                <BuildingDescription>Hovedbygningen Holstebro</BuildingDescription>
            </Room>
        </TimetableEvent>
        <TimetableEvent>
            <Date>2010-06-15</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>2</WeekdayNumber>
            <Weekday>Tirsdag</Weekday>
            <LectureNumber>2</LectureNumber>
            <StartTime>09:00</StartTime>
            <EndTime>09:45</EndTime>
            <ExaminationEvent>N</ExaminationEvent>
            <Planner>GVJ</Planner>
            <RevisionDate>2008-09-08</RevisionDate>
            <Form>UV</Form>
            <FormDescription>Undervisning</FormDescription>
            <TimetableEventLabel>Vejledning</TimetableEventLabel>
            <Subject>
                <SubjectName>63040</SubjectName>
                <Level>-</Level>
                <ShortDescription>Modul 4</ShortDescription>
                <Description>Rehabilitering og habilitering som muliggør aktivitet og deltagelse. Genoptræning og behandling I</Description>
            </Subject>
            <Teacher>
                <Initials>IVA</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Ingrid Vej</Firstname>
                <Surname>Andersen</Surname>
                <Role>UV</Role>
                <Department>VITA</Department>
            </Teacher>
            <Teacher>
                <Initials>AMK</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Anne-Mette</Firstname>
                <Surname>Kjær</Surname>
                <Role>UV</Role>
                <Department>VITA</Department>
            </Teacher>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>E75 start start august 2009</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>204 Teo</Number>
                <ShortDescription>7500-A204 Teori</ShortDescription>
                <Name>Teorilokale i bygning A</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>7500 - A</BuildingNumber>
                <BuildingDescription>Hovedbygningen Holstebro</BuildingDescription>
            </Room>
        </TimetableEvent>
        <TimetableEvent>
            <Date>2010-06-15</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>2</WeekdayNumber>
            <Weekday>Tirsdag</Weekday>
            <LectureNumber>1</LectureNumber>
            <StartTime>08:00</StartTime>
            <EndTime>08:45</EndTime>
            <ExaminationEvent>N</ExaminationEvent>
            <Planner>GVJ</Planner>
            <RevisionDate>2008-09-08</RevisionDate>
            <Form>UV</Form>
            <FormDescription>Undervisning</FormDescription>
            <TimetableEventLabel>Vejledning</TimetableEventLabel>
            <Subject>
                <SubjectName>63040</SubjectName>
                <Level>-</Level>
                <ShortDescription>Modul 4</ShortDescription>
                <Description>Rehabilitering og habilitering som muliggør aktivitet og deltagelse. Genoptræning og behandling I</Description>
            </Subject>
            <Teacher>
                <Initials>IVA</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Ingrid Vej</Firstname>
                <Surname>Andersen</Surname>
                <Role>UV</Role>
                <Department>VITA</Department>
            </Teacher>
            <Teacher>
                <Initials>AMK</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Anne-Mette</Firstname>
                <Surname>Kjær</Surname>
                <Role>UV</Role>
                <Department>VITA</Department>
            </Teacher>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>E75 start start august 2009</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>204 Teo</Number>
                <ShortDescription>7500-A204 Teori</ShortDescription>
                <Name>Teorilokale i bygning A</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>7500 - A</BuildingNumber>
                <BuildingDescription>Hovedbygningen Holstebro</BuildingDescription>
            </Room>
        </TimetableEvent>
        <TimetableEvent>
            <Date>2010-06-15</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>2</WeekdayNumber>
            <Weekday>Tirsdag</Weekday>
            <LectureNumber>6</LectureNumber>
            <StartTime>13:30</StartTime>
            <EndTime>14:15</EndTime>
            <ExaminationEvent>N</ExaminationEvent>
            <Planner>GVJ</Planner>
            <RevisionDate>2008-09-08</RevisionDate>
            <Form>UV</Form>
            <FormDescription>Undervisning</FormDescription>
            <TimetableEventLabel>Holdets time</TimetableEventLabel>
            <Subject>
                <SubjectName>63040</SubjectName>
                <Level>-</Level>
                <ShortDescription>Modul 4</ShortDescription>
                <Description>Rehabilitering og habilitering som muliggør aktivitet og deltagelse. Genoptræning og behandling I</Description>
            </Subject>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>E75 start start august 2009</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>204 Teo</Number>
                <ShortDescription>7500-A204 Teori</ShortDescription>
                <Name>Teorilokale i bygning A</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>7500 - A</BuildingNumber>
                <BuildingDescription>Hovedbygningen Holstebro</BuildingDescription>
            </Room>
        </TimetableEvent>
        <TimetableEvent>
            <Date>2010-06-15</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>2</WeekdayNumber>
            <Weekday>Tirsdag</Weekday>
            <LectureNumber>9</LectureNumber>
            <StartTime>16:30</StartTime>
            <EndTime>17:15</EndTime>
            <ExaminationEvent>N</ExaminationEvent>
            <Planner>GVJ</Planner>
            <RevisionDate>2008-09-08</RevisionDate>
            <Form>UV</Form>
            <FormDescription>Undervisning</FormDescription>
            <TimetableEventLabel>Medicin</TimetableEventLabel>
            <Subject>
                <SubjectName>63040</SubjectName>
                <Level>-</Level>
                <ShortDescription>Modul 4</ShortDescription>
                <Description>Rehabilitering og habilitering som muliggør aktivitet og deltagelse. Genoptræning og behandling I</Description>
            </Subject>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>E75 start start august 2009</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>204 Teo</Number>
                <ShortDescription>7500-A204 Teori</ShortDescription>
                <Name>Teorilokale i bygning A</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>7500 - A</BuildingNumber>
                <BuildingDescription>Hovedbygningen Holstebro</BuildingDescription>
            </Room>
        </TimetableEvent>
        <TimetableEvent>
            <Date>2010-06-15</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>2</WeekdayNumber>
            <Weekday>Tirsdag</Weekday>
            <LectureNumber>8</LectureNumber>
            <StartTime>15:30</StartTime>
            <EndTime>16:15</EndTime>
            <ExaminationEvent>N</ExaminationEvent>
            <Planner>GVJ</Planner>
            <RevisionDate>2008-09-08</RevisionDate>
            <Form>UV</Form>
            <FormDescription>Undervisning</FormDescription>
            <TimetableEventLabel>Medicin</TimetableEventLabel>
            <Subject>
                <SubjectName>63040</SubjectName>
                <Level>-</Level>
                <ShortDescription>Modul 4</ShortDescription>
                <Description>Rehabilitering og habilitering som muliggør aktivitet og deltagelse. Genoptræning og behandling I</Description>
            </Subject>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>E75 start start august 2009</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>204 Teo</Number>
                <ShortDescription>7500-A204 Teori</ShortDescription>
                <Name>Teorilokale i bygning A</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>7500 - A</BuildingNumber>
                <BuildingDescription>Hovedbygningen Holstebro</BuildingDescription>
            </Room>
        </TimetableEvent>
        <TimetableEvent>
            <Date>2010-06-15</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>2</WeekdayNumber>
            <Weekday>Tirsdag</Weekday>
            <LectureNumber>5</LectureNumber>
            <StartTime>12:30</StartTime>
            <EndTime>13:15</EndTime>
            <ExaminationEvent>N</ExaminationEvent>
            <Planner>GVJ</Planner>
            <RevisionDate>2008-09-08</RevisionDate>
            <Form>UV</Form>
            <FormDescription>Undervisning</FormDescription>
            <TimetableEventLabel>Vejledning</TimetableEventLabel>
            <Subject>
                <SubjectName>63040</SubjectName>
                <Level>-</Level>
                <ShortDescription>Modul 4</ShortDescription>
                <Description>Rehabilitering og habilitering som muliggør aktivitet og deltagelse. Genoptræning og behandling I</Description>
            </Subject>
            <Teacher>
                <Initials>IVA</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Ingrid Vej</Firstname>
                <Surname>Andersen</Surname>
                <Role>UV</Role>
                <Department>VITA</Department>
            </Teacher>
            <Teacher>
                <Initials>AMK</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Anne-Mette</Firstname>
                <Surname>Kjær</Surname>
                <Role>UV</Role>
                <Department>VITA</Department>
            </Teacher>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>E75 start start august 2009</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>204 Teo</Number>
                <ShortDescription>7500-A204 Teori</ShortDescription>
                <Name>Teorilokale i bygning A</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>7500 - A</BuildingNumber>
                <BuildingDescription>Hovedbygningen Holstebro</BuildingDescription>
            </Room>
        </TimetableEvent>
        <TimetableEvent>
            <Date>2010-06-17</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>4</WeekdayNumber>
            <Weekday>Torsdag</Weekday>
            <LectureNumber>5</LectureNumber>
            <StartTime>12:30</StartTime>
            <EndTime>13:15</EndTime>
            <ExaminationEvent>N</ExaminationEvent>
            <Planner>GVJ</Planner>
            <RevisionDate>2008-09-08</RevisionDate>
            <Form>UV</Form>
            <FormDescription>Undervisning</FormDescription>
            <TimetableEventLabel>.</TimetableEventLabel>
            <Subject>
                <SubjectName>63046</SubjectName>
                <Level>-</Level>
                <ShortDescription>M4 Fysiologi</ShortDescription>
                <Description>M04 Fysiologi</Description>
            </Subject>
            <Teacher>
                <Initials>AMJ</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Anders Møller</Firstname>
                <Surname>Jensen</Surname>
                <Role>UV</Role>
                <Department>MV</Department>
            </Teacher>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>E75 start start august 2009</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>340 Teo</Number>
                <ShortDescription>7500-A340 Teori</ShortDescription>
                <Name>Teorilokale i bygning A</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>7500 - A</BuildingNumber>
                <BuildingDescription>Hovedbygningen Holstebro</BuildingDescription>
            </Room>
        </TimetableEvent>
        <TimetableEvent>
            <Date>2010-06-17</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>4</WeekdayNumber>
            <Weekday>Torsdag</Weekday>
            <LectureNumber>4</LectureNumber>
            <StartTime>11:00</StartTime>
            <EndTime>11:45</EndTime>
            <ExaminationEvent>N</ExaminationEvent>
            <Planner>GVJ</Planner>
            <RevisionDate>2008-09-08</RevisionDate>
            <Form>UV</Form>
            <FormDescription>Undervisning</FormDescription>
            <TimetableEventLabel>.</TimetableEventLabel>
            <Subject>
                <SubjectName>63046</SubjectName>
                <Level>-</Level>
                <ShortDescription>M4 Fysiologi</ShortDescription>
                <Description>M04 Fysiologi</Description>
            </Subject>
            <Teacher>
                <Initials>AMJ</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Anders Møller</Firstname>
                <Surname>Jensen</Surname>
                <Role>UV</Role>
                <Department>MV</Department>
            </Teacher>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>E75 start start august 2009</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>340 Teo</Number>
                <ShortDescription>7500-A340 Teori</ShortDescription>
                <Name>Teorilokale i bygning A</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>7500 - A</BuildingNumber>
                <BuildingDescription>Hovedbygningen Holstebro</BuildingDescription>
            </Room>
        </TimetableEvent>
        <TimetableEvent>
            <Date>2010-06-17</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>4</WeekdayNumber>
            <Weekday>Torsdag</Weekday>
            <LectureNumber>3</LectureNumber>
            <StartTime>10:00</StartTime>
            <EndTime>10:45</EndTime>
            <ExaminationEvent>N</ExaminationEvent>
            <Planner>GVJ</Planner>
            <RevisionDate>2008-09-08</RevisionDate>
            <Form>UV</Form>
            <FormDescription>Undervisning</FormDescription>
            <TimetableEventLabel>.</TimetableEventLabel>
            <Subject>
                <SubjectName>63046</SubjectName>
                <Level>-</Level>
                <ShortDescription>M4 Fysiologi</ShortDescription>
                <Description>M04 Fysiologi</Description>
            </Subject>
            <Teacher>
                <Initials>AMJ</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Anders Møller</Firstname>
                <Surname>Jensen</Surname>
                <Role>UV</Role>
                <Department>MV</Department>
            </Teacher>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>E75 start start august 2009</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>340 Teo</Number>
                <ShortDescription>7500-A340 Teori</ShortDescription>
                <Name>Teorilokale i bygning A</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>7500 - A</BuildingNumber>
                <BuildingDescription>Hovedbygningen Holstebro</BuildingDescription>
            </Room>
        </TimetableEvent>
        <TimetableEvent>
            <Date>2010-06-17</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>4</WeekdayNumber>
            <Weekday>Torsdag</Weekday>
            <LectureNumber>2</LectureNumber>
            <StartTime>09:00</StartTime>
            <EndTime>09:45</EndTime>
            <ExaminationEvent>N</ExaminationEvent>
            <Planner>GVJ</Planner>
            <RevisionDate>2008-09-08</RevisionDate>
            <Form>UV</Form>
            <FormDescription>Undervisning</FormDescription>
            <TimetableEventLabel>.</TimetableEventLabel>
            <Subject>
                <SubjectName>63046</SubjectName>
                <Level>-</Level>
                <ShortDescription>M4 Fysiologi</ShortDescription>
                <Description>M04 Fysiologi</Description>
            </Subject>
            <Teacher>
                <Initials>AMJ</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Anders Møller</Firstname>
                <Surname>Jensen</Surname>
                <Role>UV</Role>
                <Department>MV</Department>
            </Teacher>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>E75 start start august 2009</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>340 Teo</Number>
                <ShortDescription>7500-A340 Teori</ShortDescription>
                <Name>Teorilokale i bygning A</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>7500 - A</BuildingNumber>
                <BuildingDescription>Hovedbygningen Holstebro</BuildingDescription>
            </Room>
        </TimetableEvent>
        <TimetableEvent>
            <Date>2010-06-14</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>1</WeekdayNumber>
            <Weekday>Mandag </Weekday>
            <LectureNumber>6</LectureNumber>
            <StartTime>13:30</StartTime>
            <EndTime>14:15</EndTime>
            <ExaminationEvent>N</ExaminationEvent>
            <Planner>GVJ</Planner>
            <RevisionDate>2008-09-08</RevisionDate>
            <Form>UV</Form>
            <FormDescription>Undervisning</FormDescription>
            <TimetableEventLabel>.</TimetableEventLabel>
            <Subject>
                <SubjectName>63046</SubjectName>
                <Level>-</Level>
                <ShortDescription>M4 Fysiologi</ShortDescription>
                <Description>M04 Fysiologi</Description>
            </Subject>
            <Teacher>
                <Initials>AMJ</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Anders Møller</Firstname>
                <Surname>Jensen</Surname>
                <Role>UV</Role>
                <Department>MV</Department>
            </Teacher>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>E75 start start august 2009</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>340 Teo</Number>
                <ShortDescription>7500-A340 Teori</ShortDescription>
                <Name>Teorilokale i bygning A</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>7500 - A</BuildingNumber>
                <BuildingDescription>Hovedbygningen Holstebro</BuildingDescription>
            </Room>
        </TimetableEvent>
        <TimetableEvent>
            <Date>2010-06-14</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>1</WeekdayNumber>
            <Weekday>Mandag </Weekday>
            <LectureNumber>5</LectureNumber>
            <StartTime>12:30</StartTime>
            <EndTime>13:15</EndTime>
            <ExaminationEvent>N</ExaminationEvent>
            <Planner>GVJ</Planner>
            <RevisionDate>2008-09-08</RevisionDate>
            <Form>UV</Form>
            <FormDescription>Undervisning</FormDescription>
            <TimetableEventLabel>.</TimetableEventLabel>
            <Subject>
                <SubjectName>63046</SubjectName>
                <Level>-</Level>
                <ShortDescription>M4 Fysiologi</ShortDescription>
                <Description>M04 Fysiologi</Description>
            </Subject>
            <Teacher>
                <Initials>AMJ</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Anders Møller</Firstname>
                <Surname>Jensen</Surname>
                <Role>UV</Role>
                <Department>MV</Department>
            </Teacher>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>E75 start start august 2009</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>340 Teo</Number>
                <ShortDescription>7500-A340 Teori</ShortDescription>
                <Name>Teorilokale i bygning A</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>7500 - A</BuildingNumber>
                <BuildingDescription>Hovedbygningen Holstebro</BuildingDescription>
            </Room>
        </TimetableEvent>
        <TimetableEvent>
            <Date>2010-06-14</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>1</WeekdayNumber>
            <Weekday>Mandag </Weekday>
            <LectureNumber>4</LectureNumber>
            <StartTime>11:00</StartTime>
            <EndTime>11:45</EndTime>
            <ExaminationEvent>N</ExaminationEvent>
            <Planner>GVJ</Planner>
            <RevisionDate>2008-09-08</RevisionDate>
            <Form>UV</Form>
            <FormDescription>Undervisning</FormDescription>
            <TimetableEventLabel>.</TimetableEventLabel>
            <Subject>
                <SubjectName>63046</SubjectName>
                <Level>-</Level>
                <ShortDescription>M4 Fysiologi</ShortDescription>
                <Description>M04 Fysiologi</Description>
            </Subject>
            <Teacher>
                <Initials>AMJ</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Anders Møller</Firstname>
                <Surname>Jensen</Surname>
                <Role>UV</Role>
                <Department>MV</Department>
            </Teacher>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>E75 start start august 2009</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>340 Teo</Number>
                <ShortDescription>7500-A340 Teori</ShortDescription>
                <Name>Teorilokale i bygning A</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>7500 - A</BuildingNumber>
                <BuildingDescription>Hovedbygningen Holstebro</BuildingDescription>
            </Room>
        </TimetableEvent>
        <TimetableEvent>
            <Date>2010-06-17</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>4</WeekdayNumber>
            <Weekday>Torsdag</Weekday>
            <LectureNumber>6</LectureNumber>
            <StartTime>13:30</StartTime>
            <EndTime>14:15</EndTime>
            <ExaminationEvent>N</ExaminationEvent>
            <Planner>GVJ</Planner>
            <RevisionDate>2008-09-08</RevisionDate>
            <Form>UV</Form>
            <FormDescription>Undervisning</FormDescription>
            <TimetableEventLabel>.</TimetableEventLabel>
            <Subject>
                <SubjectName>63046</SubjectName>
                <Level>-</Level>
                <ShortDescription>M4 Fysiologi</ShortDescription>
                <Description>M04 Fysiologi</Description>
            </Subject>
            <Teacher>
                <Initials>AMJ</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Anders Møller</Firstname>
                <Surname>Jensen</Surname>
                <Role>UV</Role>
                <Department>MV</Department>
            </Teacher>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>E75 start start august 2009</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>340 Teo</Number>
                <ShortDescription>7500-A340 Teori</ShortDescription>
                <Name>Teorilokale i bygning A</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>7500 - A</BuildingNumber>
                <BuildingDescription>Hovedbygningen Holstebro</BuildingDescription>
            </Room>
        </TimetableEvent>
        <TimetableEvent>
            <Date>2010-06-14</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>1</WeekdayNumber>
            <Weekday>Mandag </Weekday>
            <LectureNumber>2</LectureNumber>
            <StartTime>09:00</StartTime>
            <EndTime>09:45</EndTime>
            <ExaminationEvent>N</ExaminationEvent>
            <Planner>GVJ</Planner>
            <RevisionDate>2008-09-08</RevisionDate>
            <Form>UV</Form>
            <FormDescription>Undervisning</FormDescription>
            <TimetableEventLabel>.</TimetableEventLabel>
            <Subject>
                <SubjectName>63046</SubjectName>
                <Level>-</Level>
                <ShortDescription>M4 Fysiologi</ShortDescription>
                <Description>M04 Fysiologi</Description>
            </Subject>
            <Teacher>
                <Initials>AMJ</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Anders Møller</Firstname>
                <Surname>Jensen</Surname>
                <Role>UV</Role>
                <Department>MV</Department>
            </Teacher>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>E75 start start august 2009</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>340 Teo</Number>
                <ShortDescription>7500-A340 Teori</ShortDescription>
                <Name>Teorilokale i bygning A</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>7500 - A</BuildingNumber>
                <BuildingDescription>Hovedbygningen Holstebro</BuildingDescription>
            </Room>
        </TimetableEvent>
        <TimetableEvent>
            <Date>2010-06-14</Date>
            <WeekNumber>24</WeekNumber>
            <WeekdayNumber>1</WeekdayNumber>
            <Weekday>Mandag </Weekday>
            <LectureNumber>3</LectureNumber>
            <StartTime>10:00</StartTime>
            <EndTime>10:45</EndTime>
            <ExaminationEvent>N</ExaminationEvent>
            <Planner>GVJ</Planner>
            <RevisionDate>2008-09-08</RevisionDate>
            <Form>UV</Form>
            <FormDescription>Undervisning</FormDescription>
            <TimetableEventLabel>.</TimetableEventLabel>
            <Subject>
                <SubjectName>63046</SubjectName>
                <Level>-</Level>
                <ShortDescription>M4 Fysiologi</ShortDescription>
                <Description>M04 Fysiologi</Description>
            </Subject>
            <Teacher>
                <Initials>AMJ</Initials>
                <SerialNumber>1</SerialNumber>
                <Firstname>Anders Møller</Firstname>
                <Surname>Jensen</Surname>
                <Role>UV</Role>
                <Department>MV</Department>
            </Teacher>
            <Activity>
                <Name>EH75</Name>
                <ShortDescription>E75</ShortDescription>
                <Description>E75 start start august 2009</Description>
                <Department>EH</Department>
                <NumberOfActiveStudents>39</NumberOfActiveStudents>
            </Activity>
            <Room>
                <Number>340 Teo</Number>
                <ShortDescription>7500-A340 Teori</ShortDescription>
                <Name>Teorilokale i bygning A</Name>
                <Role>U</Role>
                <RoleType>U</RoleType>
                <BuildingNumber>7500 - A</BuildingNumber>
                <BuildingDescription>Hovedbygningen Holstebro</BuildingDescription>
            </Room>
        </TimetableEvent>
    </Timetable>
</Result>


<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:fo="http://www.w3.org/1999/XSL/Format"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt"
    >
 <xsl:output method="html"/>
    <xsl:param name="test"></xsl:param>
    <xsl:key name="t" match="/Result/Timetable/TimetableEvent" use="StartTime"/>
    <xsl:template match="/">
        <xsl:variable name="school" select="ID=/Result[ID=$test]"></xsl:variable>
        her: <xsl.value-of select="$school"></xsl.value-of>

        <table  id="skema" style="font-family: Verdana; font-size:11px; border-top: 1px solid black; border-left: 1px solid black;" width="650" cellspacing="0" >
            <tr style="font-weight:bold; height:20px; background-color:#eee;">
                <td width="100px" style="border-bottom: 1px solid black; border-right: 1px solid black;">
                    Uge <xsl:value-of select="/Result/Timetable/TimetableEvent/WeekNumber"/>
                </td>
                <td width="110px" style="border-bottom: 1px solid black; border-right: 1px solid black;">
                    Mandag<br/>
                    <xsl:call-template name="FormatDate">
                        <xsl:with-param name="DateTime" select="/Result/Timetable/TimetableEvent[WeekdayNumber=1]/Date"/>
                    </xsl:call-template>
                </td>
                <td width="110px" style="border-bottom: 1px solid black; border-right: 1px solid black;">
                    Tirsdag<br/>
                    <xsl:call-template name="FormatDate">
                        <xsl:with-param name="DateTime" select="/Result/Timetable/TimetableEvent[WeekdayNumber=2]/Date"/>
                    </xsl:call-template>

                </td>
                <td width="110px" style="border-bottom: 1px solid black; border-right: 1px solid black;">
                    Onsdag<br/>
                    <xsl:call-template name="FormatDate">
                        <xsl:with-param name="DateTime" select="/Result/Timetable/TimetableEvent[WeekdayNumber=3]/Date"/>
                    </xsl:call-template>
                </td>
                <td width="110px" style="border-bottom: 1px solid black; border-right: 1px solid black;">
                    Torsdag<br/>
                    <xsl:call-template name="FormatDate">
                        <xsl:with-param name="DateTime" select="/Result/Timetable/TimetableEvent[WeekdayNumber=4]/Date"/>
                    </xsl:call-template>
                </td>
                <td width="110px" style="border-bottom: 1px solid black; border-right: 1px solid black;">
                    Fredag<br/> 	<xsl:call-template name="FormatDate">
                        <xsl:with-param name="DateTime" select="/Result/Timetable/TimetableEvent[WeekdayNumber=5]/Date"/>
                    </xsl:call-template>
                </td>
            </tr>
            
            <xsl:variable name="skema" select="/Result/Timetable/TimetableEvent[generate-id(.) = generate-id(key('t', StartTime))]"></xsl:variable>

            <xsl:variable name="morgentid" select="count(/Result/Timetable/TimetableEvent/StartTime[text() = '08:00'])"></xsl:variable>
            <xsl:variable name="resultset" select="$skema[(number(substring-before(StartTime,':'))*100+number(substring-after(StartTime,':'))) > 799]"></xsl:variable>

            <xsl:variable name="temp">
                <Result>
                    <Timetable>

                        <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"/>
                            <TimeTableEvent>
                                <xsl:copy-of select="StartTime"/>
                                <xsl:copy-of select="EndTime"/>
                                <xsl:copy-of select="Weekday"/>
                                <xsl:copy-of select="Comment"/>
                                <xsl:copy-of select="Subject/ShortDescription"/>
                                <xsl:copy-of select="Teacher/Initials"/>
                                <xsl:copy-of select="Room/Number"/>
                                <xsl:copy-of select="Activity/ShortDescription"/>
                            </TimeTableEvent>
                    </xsl:for-each>
                    </Timetable>

                </Result>
            </xsl:variable>

            <xsl:for-each select="msxsl:node-set($temp)/Result/Timetable/TimeTableEvent">
                <xsl:sort select="number(substring-before(StartTime,':'))*100+number(substring-after(StartTime,':'))" data-type="number" order="ascending"/>
                <xsl:variable name="time" select="StartTime"/>
                <xsl:variable name="omregnettid" select="number(substring-before($time,':'))*100+number(substring-after($time,':'))"></xsl:variable>

                <xsl:if test="($morgentid = 0) and (position() = 1) and starts-with(Room/BuildingNumber, '7500')">
                    <tr>
                        <td align="right" style="border-bottom: black 1px solid; border-right: black 1px solid;">08:00 - 08:45</td>
                        <td width="110" height="30" style="border-bottom: black 1px solid; border-right: black 1px solid;">&#160;</td>
                        <td width="110" height="30" style="border-bottom: black 1px solid; border-right: black 1px solid;">&#160;</td>
                        <td width="110" height="30" style="border-bottom: black 1px solid; border-right: black 1px solid;">&#160;</td>
                        <td width="110" height="30" style="border-bottom: black 1px solid; border-right: black 1px solid;">&#160;</td>
                        <td width="110" height="30" style="border-bottom: black 1px solid; border-right: black 1px solid;">&#160;</td>

                    </tr>
                </xsl:if>
                    
                <tr>
                    <td align="right" style="border-bottom: black 1px solid; border-right: black 1px solid;">
                            <xsl:value-of select="StartTime"/> - <xsl:value-of select="EndTime"/>  
                            
                          
                </td>
                    <td height="30" width="110px" style="border-bottom: 1px solid black; border-right: 1px solid black;">
                        <xsl:call-template name="timeRender">
                            <xsl:with-param name="time" select="$time"/>
                            <xsl:with-param name="day" select="'Mandag'"/>
                        </xsl:call-template>
                    </td>
                    <td width="110" height="30" style="border-bottom: black 1px solid; border-right: black 1px solid;">
                        <xsl:call-template name="timeRender">
                            <xsl:with-param name="time" select="$time"/>
                            <xsl:with-param name="day" select="'Tirsdag'"/>
                        </xsl:call-template>                    
                    </td>
                    <td width="110" height="30" style="border-bottom: black 1px solid; border-right: black 1px solid;">
                        <xsl:call-template name="timeRender">
                            <xsl:with-param name="time" select="$time"/>
                            <xsl:with-param name="day" select="'Onsdag'"/>
                        </xsl:call-template>
                    </td>
                    <td width="110" height="30" style="border-bottom: black 1px solid; border-right: black 1px solid;">
                        <xsl:call-template name="timeRender">
                            <xsl:with-param name="time" select="$time"/>
                            <xsl:with-param name="day" select="'Torsdag'"/>
                        </xsl:call-template>
                    </td>
                    <td width="110" height="30" style="border-bottom: black 1px solid; border-right: black 1px solid;">
                        <xsl:call-template name="timeRender">
                            <xsl:with-param name="time" select="$time"/>
                            <xsl:with-param name="day" select="'Fredag'"/>
                        </xsl:call-template>
                    </td>
                </tr>

            </xsl:for-each>
        </table>

       
        
    </xsl:template>


    <xsl:template name="timeRender">
        <xsl:param name="time"/>
        <xsl:param name="day"/>
        
        <xsl:value-of select="/Result/Timetable/TimetableEvent[StartTime = $time and normalize-space(Weekday)=$day]/Comment"/>
        <br/>
        <xsl:value-of select="/Result/Timetable/TimetableEvent[StartTime = $time and normalize-space(Weekday)=$day]/ShortDescription"/>
        <br/>
        <xsl:value-of select="/Result/Timetable/TimetableEvent[StartTime = $time and normalize-space(Weekday)=$day]/Initials"/>
        <br/>
        <xsl:value-of select="/Result/Timetable/TimetableEvent[StartTime = $time and normalize-space(Weekday)=$day]/Number"/>
        <br/>
        <xsl:value-of select="/Result/Timetable/TimetableEvent[StartTime = $time and normalize-space(Weekday)=$day]/ShortDescription"/>
        <br/>
    </xsl:template>

            

    

    <xsl:template name="FormatDate">
        <xsl:param name="DateTime" />
        <!-- new date format 2006-01-14T08:55:22 -->
        <xsl:variable name="year">
            <xsl:value-of select="substring($DateTime,0,5)" />
        </xsl:variable>
        <xsl:variable name="month">
            <xsl:value-of select="substring($DateTime,6,2)" />
        </xsl:variable>
        <xsl:variable name="day">
            <xsl:value-of select="substring($DateTime,9,2)" />
        </xsl:variable>
        <xsl:value-of select="$day"/>-<xsl:value-of select="$month"/>-<xsl:value-of select="$year"/>

    </xsl:template>

</xsl:stylesheet>

Open in new window

Gertone (Geert Bormans)Information Architect
Top Expert 2006

Commented:
there is one obvious error I allready found

            <xsl:for-each select="msxsl:node-set($temp)/Result/Timetable/TimeTableEvent">

should be

            <xsl:for-each select="msxsl:node-set($temp)">

Author

Commented:
When i render the code I posted, it render the start and end times as I should! But the info for the days/time blocks i missing. If I remove "/Result/Timetable/TimeTableEvent" it dossen't render anything.

if you modify the code as follows, then you can see how it shall render:

Replace
     <xsl:for-each select="msxsl:node-set($temp)/Result/Timetable/TimeTableEvent">
with
     $skema[(number(substring-before(StartTime,':'))*100+number(substring-after(StartTime,':'))) > 799]

And replace the timerender template with this code:
<xsl:template name="timeRender">
        <xsl:param name="time"/>
        <xsl:param name="day"/>
        
        <xsl:value-of select="/Result/Timetable/TimetableEvent[StartTime = $time and normalize-space(Weekday)=$day]/Comment"/>
        <br/>
        <xsl:value-of select="/Result/Timetable/TimetableEvent[StartTime = $time and normalize-space(Weekday)=$day]/Subject/ShortDescription"/>
        <br/>
        <xsl:value-of select="/Result/Timetable/TimetableEvent[StartTime = $time and normalize-space(Weekday)=$day]/Teacher/Initials"/>
        <br/>
        <xsl:value-of select="/Result/Timetable/TimetableEvent[StartTime = $time and normalize-space(Weekday)=$day]/Room/Number"/>
        <br/>
        <xsl:value-of select="/Result/Timetable/TimetableEvent[StartTime = $time and normalize-space(Weekday)=$day]/Room/ShortDescription"/>
        <br/>
    </xsl:template>

Open in new window

Gertone (Geert Bormans)Information Architect
Top Expert 2006

Commented:
I was mistaken
it needs to be
<xsl:for-each select="msxsl:node-set($temp)//TimeTableEvent">
I am getting somewhere now

Author

Commented:
Thanks again!!
Now i am getting the start end ending times (like i did in the code i posted (ID: 33151122)), but i still miss the content for the day/time.

Thanks in advance!
Gertone (Geert Bormans)Information Architect
Top Expert 2006

Commented:
yes, looking into that now
Gertone (Geert Bormans)Information Architect
Top Expert 2006

Commented:
closing in on it, have to split for a meeting now, will fix it after my return, you will have an answer this "Onsdag", no problem :-)

Author

Commented:
It's ok, just take your time :-) Im also here at "Torsdag" ;-)
Thanks for now!!!
Information Architect
Top Expert 2006
Commented:
well, got back a lot later than originally expected

you have various issues with your stylesheet and almost all of them are related to context nodes
note that your $temp only includes the unique times. That means a lot of the TimeTableEvents are missing from there, so you need to get back to the original document for getting them.
Since you changed the context (you are looping the node-set(), not the original document, the key function will not work on them
In your current stylesheet I see no reason for having the node-set construct, but assume you will introduce that need later.
If you don't really need the node-set construct, I would drop the$tem, so you no longer need $root and you can safely use the keys everywhere
note that whilst iterating the $temp, you don't need to sort, since the node-set() is allready sorted

check this out, there is some fun stuff in here
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:fo="http://www.w3.org/1999/XSL/Format"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt"
    >
    <!--     xmlns:msxsl="http://exslt.org/common"    -->
    <xsl:output method="html"/>
    <xsl:param name="test"></xsl:param>
    <xsl:key name="t" match="TimetableEvent[(number(substring-before(StartTime,':'))*100 + number(substring-after(StartTime,':'))) > 799]" use="StartTime"/>
    
    <xsl:variable name="root" select="/"/>
    
    <xsl:template match="/">
        <xsl:variable name="school" select="ID=/Result[ID=$test]"></xsl:variable>
        <!--        her: <xsl:value-of select="$school"></xsl:value-of>
        --> 
        <table  id="skema" style="font-family: Verdana; font-size:11px; border-top: 1px solid black; border-left: 1px solid black;" width="650" cellspacing="0" >
            <tr style="font-weight:bold; height:20px; background-color:#eee;">
                <td width="100px" style="border-bottom: 1px solid black; border-right: 1px solid black;">
                    Uge <xsl:value-of select="/Result/Timetable/TimetableEvent/WeekNumber"/>
                </td>
                <td width="110px" style="border-bottom: 1px solid black; border-right: 1px solid black;">
                    Mandag<br/>
                    <xsl:call-template name="FormatDate">
                        <xsl:with-param name="DateTime" select="/Result/Timetable/TimetableEvent[WeekdayNumber=1]/Date"/>
                    </xsl:call-template>
                </td>
                <td width="110px" style="border-bottom: 1px solid black; border-right: 1px solid black;">
                    Tirsdag<br/>
                    <xsl:call-template name="FormatDate">
                        <xsl:with-param name="DateTime" select="/Result/Timetable/TimetableEvent[WeekdayNumber=2]/Date"/>
                    </xsl:call-template>
                    
                </td>
                <td width="110px" style="border-bottom: 1px solid black; border-right: 1px solid black;">
                    Onsdag<br/>
                    <xsl:call-template name="FormatDate">
                        <xsl:with-param name="DateTime" select="/Result/Timetable/TimetableEvent[WeekdayNumber=3]/Date"/>
                    </xsl:call-template>
                </td>
                <td width="110px" style="border-bottom: 1px solid black; border-right: 1px solid black;">
                    Torsdag<br/>
                    <xsl:call-template name="FormatDate">
                        <xsl:with-param name="DateTime" select="/Result/Timetable/TimetableEvent[WeekdayNumber=4]/Date"/>
                    </xsl:call-template>
                </td>
                <td width="110px" style="border-bottom: 1px solid black; border-right: 1px solid black;">
                    Fredag<br/> 	<xsl:call-template name="FormatDate">
                        <xsl:with-param name="DateTime" select="/Result/Timetable/TimetableEvent[WeekdayNumber=5]/Date"/>
                    </xsl:call-template>
                </td>
            </tr>
            
            <xsl:variable name="skema" select="//TimetableEvent[generate-id(.) = generate-id(key('t', StartTime)[1])]"></xsl:variable>
            
            <xsl:variable name="morgentid" select="count(/Result/Timetable/TimetableEvent/StartTime[text() = '08:00'])"></xsl:variable>
            <xsl:variable name="resultset" select="$skema"/>

            <xsl:variable name="temp">
                <Result>
                    <Timetable>
                        <xsl:for-each select="$skema">
                            <xsl:sort select="substring-before(StartTime,':')" data-type="number" order="ascending"/>
                            <xsl:sort select="substring-after(StartTime,':')" data-type="number" order="ascending"/>
                            <TimeTableEvent>
                                <xsl:copy-of select="StartTime"/>
                                <xsl:copy-of select="EndTime"/>
                                <xsl:copy-of select="Weekday"/>
                                <xsl:copy-of select="Comment"/>
                                <xsl:copy-of select="Subject/ShortDescription"/>
                                <xsl:copy-of select="Teacher/Initials"/>
                                <xsl:copy-of select="Room/Number"/>
                                <xsl:copy-of select="Activity/ShortDescription"/>
                            </TimeTableEvent>
                        </xsl:for-each>
                    </Timetable>
                </Result>
            </xsl:variable>
             <xsl:for-each select="msxsl:node-set($temp)//TimeTableEvent">
                <!--                <xsl:sort select="number(substring-before(StartTime,':'))*100+number(substring-after(StartTime,':'))" data-type="number" order="ascending"/>
                -->                <xsl:variable name="time" select="StartTime"/>
                <xsl:variable name="omregnettid" select="number(substring-before($time,':'))*100+number(substring-after($time,':'))"></xsl:variable>
                
                <xsl:if test="($morgentid = 0) and (position() = 1) and starts-with(Room/BuildingNumber, '7500')">
                    <tr>
                        <td align="right" style="border-bottom: black 1px solid; border-right: black 1px solid;">08:00 - 08:45</td>
                        <td width="110" height="30" style="border-bottom: black 1px solid; border-right: black 1px solid;">&#160;</td>
                        <td width="110" height="30" style="border-bottom: black 1px solid; border-right: black 1px solid;">&#160;</td>
                        <td width="110" height="30" style="border-bottom: black 1px solid; border-right: black 1px solid;">&#160;</td>
                        <td width="110" height="30" style="border-bottom: black 1px solid; border-right: black 1px solid;">&#160;</td>
                        <td width="110" height="30" style="border-bottom: black 1px solid; border-right: black 1px solid;">&#160;</td>
                        
                    </tr>
                </xsl:if>
                
                <tr>
                    <td align="right" style="border-bottom: black 1px solid; border-right: black 1px solid;">
                        <xsl:value-of select="StartTime"/> - <xsl:value-of select="EndTime"/>  
                        
                        
                    </td>
                    <td height="30" width="110px" style="border-bottom: 1px solid black; border-right: 1px solid black;">
                        <xsl:call-template name="timeRender">
                            <xsl:with-param name="time" select="$time"/>
                            <xsl:with-param name="day" select="'Mandag'"/>
                        </xsl:call-template>
                    </td>
                    <td width="110" height="30" style="border-bottom: black 1px solid; border-right: black 1px solid;">
                        <xsl:call-template name="timeRender">
                            <xsl:with-param name="time" select="$time"/>
                            <xsl:with-param name="day" select="'Tirsdag'"/>
                        </xsl:call-template>                    
                    </td>
                    <td width="110" height="30" style="border-bottom: black 1px solid; border-right: black 1px solid;">
                        <xsl:call-template name="timeRender">
                            <xsl:with-param name="time" select="$time"/>
                            <xsl:with-param name="day" select="'Onsdag'"/>
                        </xsl:call-template>
                    </td>
                    <td width="110" height="30" style="border-bottom: black 1px solid; border-right: black 1px solid;">
                        <xsl:call-template name="timeRender">
                            <xsl:with-param name="time" select="$time"/>
                            <xsl:with-param name="day" select="'Torsdag'"/>
                        </xsl:call-template>
                    </td>
                    <td width="110" height="30" style="border-bottom: black 1px solid; border-right: black 1px solid;">
                        <xsl:call-template name="timeRender">
                            <xsl:with-param name="time" select="$time"/>
                            <xsl:with-param name="day" select="'Fredag'"/>
                        </xsl:call-template>
                    </td>
                </tr>
                
            </xsl:for-each>
        </table>
        
        
        
    </xsl:template>
    
    
    <xsl:template name="timeRender">
        <xsl:param name="time"/>
        <xsl:param name="day"/>
        <xsl:variable name="this-day-time" select="$root//TimetableEvent[StartTime = $time][normalize-space(Weekday)=$day]"/>
        <xsl:value-of select="$this-day-time/Comment"/>
        <br/>
        <xsl:value-of select="$this-day-time/Subject/ShortDescription"/>
        <br/>
        <xsl:value-of select="$this-day-time/Teacher/Initials"/>
        <br/>
        <xsl:value-of select="$this-day-time/Room/Number"/>
        <br/>
        <xsl:value-of select="$this-day-time/Room/ShortDescription"/>
        <br/>
    </xsl:template>
    
    
    
    
    
    <xsl:template name="FormatDate">
        <xsl:param name="DateTime" />
        <!-- new date format 2006-01-14T08:55:22 -->
        <xsl:variable name="year">
            <xsl:value-of select="substring($DateTime,0,5)" />
        </xsl:variable>
        <xsl:variable name="month">
            <xsl:value-of select="substring($DateTime,6,2)" />
        </xsl:variable>
        <xsl:variable name="day">
            <xsl:value-of select="substring($DateTime,9,2)" />
        </xsl:variable>
        <xsl:value-of select="$day"/>-<xsl:value-of select="$month"/>-<xsl:value-of select="$year"/>
    </xsl:template>
    
</xsl:stylesheet>

Open in new window

Author

Commented:
It works :-) You are great!!

Thank you very much for your excellent help

Author

Commented:
Absolute the best help i have ever got!
Gertone (Geert Bormans)Information Architect
Top Expert 2006

Commented:
welcome

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial