[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] What is the best solution?


Subject: [xsl] What is the best solution?
From: <trond.huso@xxxxxx>
Date: Mon, 25 Mar 2013 14:12:47 +0000

I have a structure like the one below:


        <ns1:Event>
            <ns1:Name>Anders Jacobsen - Anders Bardal</ns1:Name>
            <ns1:MatchId>331782</ns1:MatchId>
            <ns1:ArrangementId>100000214</ns1:ArrangementId>
            <ns1:ArrangementName>HS215</ns1:ArrangementName>
            <ns1:SportId>83</ns1:SportId>
            <ns1:SportName>Hopp</ns1:SportName>
            <ns1:Time>2013-03-22T15:15:00.000+01:00</ns1:Time>
            <ns1:Status Id="0">Ikke startet</ns1:Status>
            <ns1:Item id="13869">
                <ns1:Number>1</ns1:Number>
                <ns1:Name>Anders Jacobsen</ns1:Name>
                <ns1:ShortName>Jacobse</ns1:ShortName>
                <ns1:Abbreviation>Anders Jacobsen</ns1:Abbreviation>
            </ns1:Item>
            <ns1:Item id="13789">
                <ns1:Number>2</ns1:Number>
                <ns1:Name>Anders Bardal</ns1:Name>
                <ns1:ShortName>Bardal</ns1:ShortName>
                <ns1:Abbreviation>Anders Bardal</ns1:Abbreviation>
            </ns1:Item>
            <ns1:BetObject Name="H2H - duell" Id="181292">
                <ns1:BetObjectNumber>56</ns1:BetObjectNumber>
                <ns1:Date>2013-03-22T14:15:00.000+01:00</ns1:Date>
                <ns1:SaleStartTime>2013-03-21T11:15:00.000+01:00</ns1:SaleSta
rtTime>
                <ns1:SaleStopTime>2013-03-22T14:15:00.000+01:00</ns1:SaleStop
Time>
                <ns1:SaleStatusNo>1</ns1:SaleStatusNo>
                <ns1:SaleStatusName>Open</ns1:SaleStatusName>
                <ns1:SaleAmount>0</ns1:SaleAmount>
                <ns1:Selection>
                    <ns1:SelectionSeqNo>1</ns1:SelectionSeqNo>
                    <ns1:SelectionName>Anders Jacobsen</ns1:SelectionName>
                    <ns1:SelectionOdds>1.35</ns1:SelectionOdds>
                    <ns1:Withdrawn>false</ns1:Withdrawn>
                </ns1:Selection>
                <ns1:Selection>
                    <ns1:SelectionSeqNo>2</ns1:SelectionSeqNo>
                    <ns1:SelectionName>Anders Bardal</ns1:SelectionName>
                    <ns1:SelectionOdds>2.5</ns1:SelectionOdds>
                    <ns1:Withdrawn>false</ns1:Withdrawn>
                </ns1:Selection>
                <ns1:AllowedCombinations>
                    <ns1:Min>2</ns1:Min>
                    <ns1:Max>10</ns1:Max>
                </ns1:AllowedCombinations>
                <ns1:SaleChannels>
                    <ns1:SaleChannel>
                        <ns1:SaleChannelNo>1</ns1:SaleChannelNo>
                        <ns1:SaleStartTime>2013-03-22T00:00:00.000+01:00</ns1
:SaleStartTime>
                        <ns1:SaleStopTime>2013-03-22T14:15:00.000+01:00</ns1:
SaleStopTime>
                    </ns1:SaleChannel>
                    <ns1:SaleChannel>
                        <ns1:SaleChannelNo>2</ns1:SaleChannelNo>
                        <ns1:SaleStartTime>2013-03-21T11:15:00.000+01:00</ns1
:SaleStartTime>
                        <ns1:SaleStopTime>2013-03-22T14:15:00.000+01:00</ns1:
SaleStopTime>
                    </ns1:SaleChannel>
                    <ns1:SaleChannel>
                        <ns1:SaleChannelNo>7</ns1:SaleChannelNo>
                        <ns1:SaleStartTime>2013-03-21T11:15:00.000+01:00</ns1
:SaleStartTime>
                        <ns1:SaleStopTime>2013-03-22T14:15:00.000+01:00</ns1:
SaleStopTime>
                    </ns1:SaleChannel>
                </ns1:SaleChannels>
            </ns1:BetObject>
            <ns1:LivebetObjects>false</ns1:LivebetObjects>
            <ns1:BroadcastInformation>
                <ns1:ChannelName>Plancia - NRK</ns1:ChannelName>
            </ns1:BroadcastInformation>
            <ns1:ExternalEventId>0</ns1:ExternalEventId>
            <ns1:Withdrawn>false</ns1:Withdrawn>
        </ns1:Event>

That is supposed to be like this:
<table class="4-col">
        <tr>
          <td>16.55</td>
          <td>H</td>
          <td>U</td>
          <td>B</td>
        </tr>
      </table>
      <p class="txt" />
      <table class="9-col">
        <tr>
          <td>1</td>
          <td>Armenia - Tsjekkia</td>
          <td align="right">3,65</td>
          <td align="right">3,30</td>
          <td align="right">1,75</td>
          <td align="right">VMKB</td>
          <td align="center">H</td>
          <td align="center">U</td>
          <td align="center">B</td>
        </tr>
<tr>
          <td>2</td>
          <td>Armenia - Tsjekkia Handikap 1-0</td>
          <td align="right">1,75</td>
          <td align="right">3,45</td>
          <td align="right">3,15</td>
          <td align="right" />
          <td align="center">H</td>
          <td align="center">U</td>
          <td align="center">B</td>
        </tr>
      </table>
      <p class="txt" />
      <table class="4-col">
        <tr>
          <td>17.55</td>
....

So as you can see I need to group dates and times, and also sort the numbers.
I have tried the group-by and used substring-before(...,'T') but that has not
returned the wanted result.

I am currently playing with the idea of splitting the date into either two
elements or one element with two attributes. Then doing a second run on the
current with grouping and so on...
Is that the right path to follow, or do you a better idea on how to solve
this?



Best

Trond Husx
System Developer NTB, Norway


Current Thread