Вот мой код для запроса мыла и распечатки xml:
header("Content-Type:text/xml");
$client = new SoapClient("http://---.---.-----------.--/EMSAPI/Service.asmx?wsdl", array('trace'=>1));
date_default_timezone_set("America/Chicago");
$result = $client->GetBookings(array('UserName' => "api", "Password" => "apitest", "StartDate" => date("H:i:s", strtotime("Today")), "EndDate"=> date("H:i:s", strtotime("Today")), "Buildings" =>array("int" => "1"), "Statuses" =>array("int"=>"1001"), "ViewComboRoomComponents" => true ));
$resString = html_entity_decode($client->__getLastResponse());
echo str_replace('<?xml version="1.0" encoding="utf-8"?>', '<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet href="bookings.xsl" type="text/xsl"?>', $resString);
Я бы хотел отформатировать этот макет XML и отсортировать его по времени:
<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet href="bookings.xsl" type="text/xsl"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GetBookingsResponse xmlns="http://DEA.EMS.API.Web.Service/"><GetBookingsResult><Bookings>
<Data>
<BookingDate>2012-01-20T00:00:00-06:00</BookingDate>
<StartBookingDate>2012-01-20T00:00:00-06:00</StartBookingDate>
<RoomDescription>Memorial N103 Stotler</RoomDescription>
<TimeEventStart>2012-01-20T10:00:00-06:00</TimeEventStart>
<TimeEventEnd>2012-01-20T12:00:00-06:00</TimeEventEnd>
<GroupName>Asian Affairs Center</GroupName>
<EventName>TaLK</EventName>
<SetupTypeDescription>Chairs In Rows</SetupTypeDescription>
<SetupCount>15</SetupCount>
<ReservationID>60750</ReservationID>
<EventCoordinator>CJ</EventCoordinator>
<GroupID>4036</GroupID>
<VIP xml:space="preserve"> </VIP>
<VIPEvent>false</VIPEvent>
<ClosedAllDay>false</ClosedAllDay>
<OpenTime>1900-01-01T07:00:00-06:00</OpenTime>
<CloseTime>1900-01-01T00:00:00-06:00</CloseTime>
<GroupTypeDescription>Campus Use</GroupTypeDescription>
<EventTypeDescription>Lecture/Seminar</EventTypeDescription>
<Contact>Jessica Fitzgerald 882-6902</Contact>
<AltContact />
<BookingID>322710</BookingID>
<TimeBookingStart>2012-01-20T08:42:00-06:00</TimeBookingStart>
<TimeBookingEnd>2012-01-20T12:15:00-06:00</TimeBookingEnd>
<GMTStartTime>2012-01-20T14:42:00-06:00</GMTStartTime>
<GMTEndTime>2012-01-20T18:15:00-06:00</GMTEndTime>
<TimeZone>CT</TimeZone>
<BuildingCode>Memorial</BuildingCode>
<Building>Memorial Union Meeting Rooms</Building>
<RoomCode>N103 Stotler</RoomCode>
<Room>N103 Stotler Lounge All</Room>
<RoomID>2409</RoomID>
<BuildingID>1</BuildingID>
<StatusID>1001</StatusID>
<StatusTypeID>-14</StatusTypeID>
<EventTypeID>2420</EventTypeID>
<GroupTypeID>2305</GroupTypeID>
<DateAdded>2011-12-30T11:13:47.81-06:00</DateAdded>
<AddedBy>Chareba Johnson</AddedBy>
<DateChanged>2012-01-17T11:37:22.38-06:00</DateChanged>
<ChangedBy>Kaitlin Hinkle</ChangedBy>
</Data>
</Bookings></GetBookingsResult></GetBookingsResponse></soap:Body></soap:Envelope>
Сейчас я просто пытаюсь заставить что-то появиться, применяя таблицу стилей. Итак, это то, что я имею до сих пор:
<xsl:template match="//soap:Envelope/GetBookingsResponse/GetBookingsResult/Bookings/Data">
<xsl:apply-templates select="*/*/EventName"/>
</xsl:template>
</xsl:stylesheet>
Помощь будет принята с благодарностью!