Hi , I am new learner of XSLT. From last couple of days I am trying to transform the following XML file. But facing issue while handling namespaces in that XML file.
This is the input XML file I have
Code:
<tcpTraceLog tcpTraceVersion='0.8.1.717' xmlns='http://www.pocketsoap.com/tcptrace/xmlformat/01' xmlns:xsd='http://www.w3.org/1999/XMLSchema' xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance'>
<logStarted xsi:type='xsd:timeInstant'>2010-10-26T19:09:26-04:00</logStarted>
<connection>
<loggedAt xsi:type='xsd:timeInstant'>2010-10-26T19:11:41-04:00</loggedAt>
<source>3.152.82.191</source>
<clientData>POST /wss/services/OnAirService HTTP/1.1
Content-Length: 345
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:login.onair.sintecmedia.com">
<soapenv:Header/>
<soapenv:Body>
<urn:login>
<urn:in0>DHAWKS</urn:in0>
</urn:login>
</soapenv:Body>
</soapenv:Envelope></clientData>
<serverData>HTTP/1.1 500 Internal Server Error
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ns2="urn:stub.onair.sintecmedia.com"
xmlns:ns1="urn:login.onair.sintecmedia.com">
<SOAP-ENV:Header></SOAP-ENV:Header>
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<ns2:message_>
<ns2:code>Client.InvalidCredentials
</ns2:code>
</ns2:message_>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
</serverData>
</connection>
</tcpTraceLog>
In this XML file I am just trying to display two elements(mentioned in red colour) in html file.
For the above requirement I wrote a some ugly XSLT code its not working fine
XSLT CODE :
Code:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:abc="http://www.pocket.com/tcptrace/xmlformat/01" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:urn="urn:login.onair.sintecmedia.com"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns2="urn:stub.onair.sintecmedia.com" xmlns:ns1="urn:login.onair.sintecmedia.com"
xmlns:int="http://SintecMedia.com/OnAir/interfaces" version="1.0">
<xsl:output method="html"/>
<xsl:template match="abc:tcpTraceLog/*/urn:in0 ">
<html>
<body>
<xsl:value-of select="."/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Expected output :
DHAWKS
Thanks in Advance for any one great help...