|
Помогите с XSL .
|
|||
---|---|---|---|
#18+
Пожалуйста, помогите глупому человеку. Необходимо сделать таблицу. Где шапки таблицы (город, авиакомпания 1, авиакомпания 2, авиакомпания 3, а содержимое таблицы направления и билеты соответственно. вот код xml файла и ниже xsl соответственно. <?xml version="1.0" encoding="Windows-1251"?> <?xml-stylesheet type="text/xsl" href="rbx.xsl"?> <reservbuy> <destination name="Рейсы из Новосибирска"> <route arrival="Домодедово" country="Россия"> <titel>Москва</titel> <S7> <flights nums="S7-421" priceecs="8900" pricebs="18900" times="10:25 - 11:40" dayss="пн, вт, ср, сб"><![CDATA[Рейс "№1":]]></flights> <flights nums="S7-567" priceecs="19000" pricebs="28900" times="18:00 - 19:10" dayss="пн, вт, ср, пт, вс"><![CDATA[Рейс "№2":]]></flights> <flights nums="S7-896" priceecs="7900" pricebs="16080" times="05:10 - 06:15" dayss="пн, вт, ср, сб"><![CDATA[Рейс №3:]]></flights> </S7> <aeroflot> <flighta numa="SU-854" priceeca="12700" priceba="39900" timea="11:00 - 12:15" daysa="пн, вт, ср, чт, пт, сб, вс"><![CDATA[Рейс "№4":]]></flighta> <flighta numa="SU-862" priceeca="13500" priceba="52800" timea="17:25 - 18:45" daysa="пн, вт, ср, сб"><![CDATA[Рейс "№:5"]]></flighta> <flighta numa="SU-426" priceeca="8600" priceba="37900" timea="04:15 - 05:30" daysa="пн, вт, ср, чт"><![CDATA[Рейс №6:]]></flighta> </aeroflot> <transaero> <flightt numt="UN-135" priceect="10800" pricebt="21700" timet="09:25 - 10:35" dayst="пн, пт"><![CDATA[Рейс "№7":]]></flightt> <flightt numt="UN-247" priceect="12400" pricebt="25800" timet="16:25 - 17:40" dayst="пн, ср, сб"><![CDATA[Рейс "№8":]]></flightt> </transaero> </route> <route arrival="Пулково" country="Россия"> <titel>Санкт-Петербург</titel> <S7> <flights nums="S7-555" priceecs="13900" pricebs="29900" times="09:20 - 11:10" dayss="пн, ср, сб, вс"><![CDATA[Рейс "№1":]]></flights> <flights nums="S7-777" priceecs="16000" pricebs="34700" times="18:30 - 20:15" dayss="пн, ср, чт, пт, вс"><![CDATA[Рейс "№2":]]></flights> <flights nums="S7-888" priceecs="9900" pricebs="18500" times="03:40 - 05:25" dayss="пн, ср, пт, сб"><![CDATA[Рейс "№3":]]></flights> </S7> <aeroflot> <flighta numa="SU-111" priceeca="18700" priceba="40900" timea="11:15 - 13:00" daysa="пн, вт, ср"><![CDATA[Рейс "№4":]]></flighta> <flighta numa="SU-222" priceeca="14800" priceba="38600" timea="16:25 - 18:55" daysa="чт, пт, сб, вс"><![CDATA[Рейс "№5":]]></flighta> </aeroflot> <transaero> <flightt numt="UN-333" priceect="11800" pricebt="28700" timet="06:40 - 08:35" dayst="пн, пт, сб, вс"><![CDATA[Рейс "№6":]]></flightt> <flightt numt="UN-999" priceect="8400" pricebt="22800" timet="23:05 - 01:40" dayst="пн, ср, чт, сб"><![CDATA[Рейс "№7":]]></flightt> </transaero> </route> <route arrival="Ататюрк" country="Турция"> <titel>Стамбул</titel> <S7> <flights nums="S7-551" priceecs="18900" pricebs="34900" times="06:10 - 08:10" dayss="пн, сб, вс"><![CDATA[Рейс "№1":]]></flights> <flights nums="S7-772" priceecs="19000" pricebs="38700" times="14:45 - 17:45" dayss="пн, ср, чт, пт, вс"><![CDATA[Рейс "№2":]]></flights> <flights nums="S7-883" priceecs="12000" pricebs="27500" times="04:55 - 07:55" dayss="вт, ср, пт, сб"><![CDATA[Рейс "№3":]]></flights> </S7> <aeroflot> <flighta numa="SU-114" priceeca="21700" priceba="46900" timea="10:15 - 13:10" daysa="пн, вт, ср"><![CDATA[Рейс "№4":]]></flighta> <flighta numa="SU-225" priceeca="11800" priceba="32600" timea="13:25 - 16:25" daysa="ср, чт, пт, сб, вс"><![CDATA[Рейс "№5":]]></flighta> <flighta numa="SU-229" priceeca="17800" priceba="36600" timea="21:45 - 01:55" daysa="пн, чт, пт, сб, вс"><![CDATA[Рейс "№6":]]></flighta> </aeroflot> <transaero> <flightt numt="UN-336" priceect="16800" pricebt="28900" timet="07:40 - 10:35" dayst="вт, ср, пт, сб, вс"><![CDATA[Рейс "№7":]]></flightt> <flightt numt="UN-997" priceect="12700" pricebt="27500" timet="19:05 - 22:20" dayst="пн, ср, чт, сб"><![CDATA[Рейс "№8":]]></flightt> <flightt numt="UN-990" priceect="11900" pricebt="26800" timet="05:05 - 08:20" dayst="пн, вт, ср, чт, сб"><![CDATA[Рейс "№8":]]></flightt> </transaero> </route> </destination> <destination name="Рейсы в Новосибирск"> <route arrival="Руине" country="Чехия"> <titel>Прага</titel> <S7> <flights nums="S7-151" priceecs="19700" pricebs="45900" times="05:15 - 07:10" dayss="сб, вс"><![CDATA[Рейс "№1":]]></flights> <flights nums="S7-272" priceecs="23800" pricebs="51700" times="16:45 - 18:55" dayss="пн, ср"><![CDATA[Рейс "№2":]]></flights> </S7> <aeroflot> <flighta numa="SU-414" priceeca="27700" priceba="57900" timea="18:55 - 19:10" daysa="пн, вт"><![CDATA[Рейс "№3":]]></flighta> <flighta numa="SU-525" priceeca="22800" priceba="50600" timea="06:25 - 08:25" daysa="ср, чт"><![CDATA[Рейс "№4":]]></flighta> <flighta numa="SU-929" priceeca="24800" priceba="54600" timea="09:30 - 11:45" daysa="пт, сб, вс"><![CDATA[Рейс "№5":]]></flighta> </aeroflot> <transaero> <flightt numt="UN-636" priceect="26800" pricebt="56900" timet="13:40 - 15:55" dayst="вт"><![CDATA[Рейс "№6":]]></flightt> <flightt numt="UN-797" priceect="23700" pricebt="54500" timet="21:25 - 23:35" dayst="чт"><![CDATA[Рейс "№7":]]></flightt> <flightt numt="UN-890" priceect="19900" pricebt="46800" timet="03:05 - 05:20" dayst="сб"><![CDATA[Рейс "№8":]]></flightt> </transaero> </route> <route arrival="Эль-Прат" country="Испания"> <titel>Барселона</titel> <S7> <flights nums="S7-951" priceecs="18900" pricebs="34900" times="07:10 - 11:30" dayss="пн, чт, пт, сб, вс"><![CDATA[Рейс "№1":]]></flights> <flights nums="S7-702" priceecs="19000" pricebs="38700" times="18:45 - 22:55" dayss="пн, ср, вс"><![CDATA[Рейс "№2":]]></flights> <flights nums="S7-683" priceecs="12000" pricebs="27500" times="02:05 - 06:55" dayss="вт, ср"><![CDATA[Рейс "№3":]]></flights> </S7> <aeroflot> <flighta numa="SU-814" priceeca="21700" priceba="46900" timea="14:15 - 18:10" daysa="пн, вт, ср"><![CDATA[Рейс "№4":]]></flighta> <flighta numa="SU-425" priceeca="11800" priceba="32600" timea="07:25 - 11:25" daysa="пт, сб, вс"><![CDATA[Рейс "№5":]]></flighta> <flighta numa="SU-529" priceeca="17800" priceba="36600" timea="20:45 - 00:55" daysa="чт, пт"><![CDATA[Рейс "№6":]]></flighta> </aeroflot> <transaero> <flightt numt="UN-136" priceect="16800" pricebt="28900" timet="12:40 - 16:55" dayst="вт, ср, пт, сб, вс"><![CDATA[Рейс "№7":]]></flightt> </transaero> </route> <route arrival="Шереметьево" country="Россия"> <titel>Москва</titel> <S7> <flights nums="S7-351" priceecs="18900" pricebs="34900" times="09:10 - 10:15" dayss="пн, сб, вс"><![CDATA[Рейс "№1":]]></flights> <flights nums="S7-472" priceecs="19000" pricebs="38700" times="17:45 - 18:45" dayss="пн, ср, чт, пт, вс"><![CDATA[Рейс "№2":]]></flights> <flights nums="S7-583" priceecs="12000" pricebs="27500" times="02:55 - 03:55" dayss="вт, ср, пт, сб"><![CDATA[Рейс "№3":]]></flights> </S7> <aeroflot> <flighta numa="SU-164" priceeca="21700" priceba="46900" timea="12:15 - 13:10" daysa="пн, вт, ср. сб, вс"><![CDATA[Рейс "№4":]]></flighta> <flighta numa="SU-275" priceeca="11800" priceba="32600" timea="19:25 - 20:25" daysa="чт, пт, сб, вс"><![CDATA[Рейс "№5":]]></flighta> <flighta numa="SU-279" priceeca="17800" priceba="36600" timea="23:45 - 00:55" daysa="пн, ср, чт, пт, сб, вс"><![CDATA[Рейс "№6":]]></flighta> </aeroflot> <transaero> <flightt numt="UN-346" priceect="16800" pricebt="28900" timet="04:40 - 05:35" dayst="вт, ср, сб, вс"><![CDATA[Рейс "№7":]]></flightt> <flightt numt="UN-957" priceect="12700" pricebt="27500" timet="11:05 - 12:20" dayst="пн, ср, сб"><![CDATA[Рейс "№8":]]></flightt> <flightt numt="UN-960" priceect="11900" pricebt="26800" timet="17:05 - 18:20" dayst="вт, ср, чт, сб"><![CDATA[Рейс "№9":]]></flightt> </transaero> </route> </destination> </reservbuy> КОД xsl: <xsl:stylesheet xmlns:xsl=" http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> <h1>Рейсы аэропорта города Новосибирска (купить/забронировать)</h1> <xsl:apply-templates select="reservbuy/destination"> <xsl:sort order="ascending" select="@name"/> </xsl:apply-templates> </xsl:template> <xsl:template match="destination"> <h2><xsl:value-of select="@name"/></h2> <table border="1" width="100%"> <thead> <th width="25%">Город</th> <th width="25%">Авиакомпания "S7"</th> <th width="25%">Авиакомпания "Аэролот"</th> <th width="25%">Авиакомпания "Трансаэро"</th> </thead> <xsl:apply-templates select="route"/> </table> </xsl:template> <xsl:template match="route"> <tr> <td> <xsl:value-of select="titel"/><br/> <i>(аэропорт - <xsl:value-of select="@arrival"/>, страна - <xsl:value-of select="@country"/>)</i> </td> <td><xsl:apply-templates select="S7/flights"/></td> <td><xsl:apply-templates select="aeroflot/flighta"/></td> <td><xsl:apply-templates select="transaero/flightt"/></td> </tr> </xsl:template> <xsl:template match="S7/flights"> <xsl:value-of select="."/> <i> (номер - <xsl:value-of select="@nums"/>, цена эконом-класса - <xsl:value-of select="@priceecs"/>, цена бизнес-класса - <xsl:value-of select="@pricebs"/>, время отправки - прибытия - <xsl:value-of select="@times"/>, дни отправки - <xsl:value-of select="@dayss"/>) </i> <br/> </xsl:template> <xsl:template match="aeroflot/flighta"> <xsl:value-of select="."/> <i> (номер - <xsl:value-of select="@numa"/>, цена эконом-класса - <xsl:value-of select="@priceeca"/>, цена бизнес-класса - <xsl:value-of select="@priceba"/>, время отправки - прибытия - <xsl:value-of select="@timea"/>, дни отправки - <xsl:value-of select="@daysa"/>) </i> <br/> </xsl:template> <xsl:template match="transaero/flightt"> <xsl:value-of select="."/> <i> (номер - <xsl:value-of select="@numt"/>, цена эконом-класса - <xsl:value-of select="@priceect"/>, цена бизнес-класса - <xsl:value-of select="@pricebt"/>, время отправки - прибытия - <xsl:value-of select="@timet"/>, дни отправки - <xsl:value-of select="@dayst"/>) </i> <br/> </xsl:template> </xsl:stylesheet> ... |
|||
:
Нравится:
Не нравится:
|
|||
07.12.2014, 21:52 |
|
Помогите с XSL .
|
|||
---|---|---|---|
#18+
glupost22вот код xml файла и ниже xsl соответственно.И, что там не работает? Вроде, все правильно ... |
|||
:
Нравится:
Не нравится:
|
|||
08.12.2014, 19:55 |
|
Помогите с XSL .
|
|||
---|---|---|---|
#18+
Да вот таблица и не выходит, только сплошной текст( ... |
|||
:
Нравится:
Не нравится:
|
|||
08.12.2014, 22:11 |
|
Помогите с XSL .
|
|||
---|---|---|---|
#18+
Код: xml 1. 2.
... |
|||
:
Нравится:
Не нравится:
|
|||
09.12.2014, 06:24 |
|
|
start [/forum/topic.php?fid=14&msg=38828802&tid=1332274]: |
0ms |
get settings: |
12ms |
get forum list: |
13ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
172ms |
get topic data: |
11ms |
get forum data: |
3ms |
get page messages: |
49ms |
get tp. blocked users: |
2ms |
others: | 245ms |
total: | 513ms |
0 / 0 |