Hi all
Have a problem when transforming an XML into another XML
The original (source) xml looks like this:
Code:
<?xml version="1.0" encoding="utf-8"?>
<CancelOrderOut xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.netadmin.se/2006/API_XMLSchema">
<subscription>
<subscription_id>133039</subscription_id>
<subscription_state>
<state_id>100</state_id>
<state_name>Disconnected</state_name>
</subscription_state>
</subscription>
<reply>
<err_number>0</err_number>
<err_description />
</reply>
</CancelOrderOut>
while the xsl is as follows:
Code:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns="http://www.netadmin.se/2006/API_XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" version="1.0" encoding='UTF-8' indent="yes"/>
<xsl:template match="/">
<MESSAGE>
<HEADER>
<MESSAGE_ID/>
<REFERENCE_ID></REFERENCE_ID>
<OPP_REFERENCE_ID></OPP_REFERENCE_ID>
<MESSAGE_CODE>HK_FROM_NETADMIN</MESSAGE_CODE>
<VERSION>1</VERSION>
<CREATION_DATE></CREATION_DATE>
<SENDER_NAME>NETadmin</SENDER_NAME>
<RECIPIENT_NAME>Herkules</RECIPIENT_NAME>
</HEADER>
<HK_FROM_NETADMIN>
<LIST_OF_COMP_PARAMETERS>
<xsl:choose>
<xsl:when test="/CancelOrderOut/reply/err_number = 0">
<STATUS_CODE>0</STATUS_CODE>
<RETURN_CODE>OK</RETURN_CODE>
</xsl:when>
<xsl:otherwise>
<STATUS_CODE><xsl:value-of select="/CancelOrderOut/reply/err_number"/></STATUS_CODE>
<RETURN_CODE>ERROR</RETURN_CODE>
<STATUS_MSG>NETadmin error. Message from NETadmin adapter.</STATUS_MSG>
</xsl:otherwise>
</xsl:choose>
</LIST_OF_COMP_PARAMETERS>
</HK_FROM_NETADMIN>
</MESSAGE>
</xsl:template>
</xsl:stylesheet>
The problem is that when using the xmlns in source XML, XPATH doesn't seem to work in XSL, whilst removing the xmlns decl from source XML (and then also in XSL of course), it works fine. I can't find the problem here, the xmlns looks the same in both source xml an xsl 8copied it, actually)
Hope you might see the problem better than me here...
Thanks in advance
/R