0
votes

<xsl:template match="/">
    <xsl:apply-templates select="mea:PublishVS_PPWO"/>
</xsl:template>

<xsl:template match="mea:PublishVS_PPWO">
    <xsl:apply-templates select="mea:VS_PPWOSet"/>
</xsl:template>

<xsl:template match="mea:VS_PPWOSet">
    <xsl:apply-templates select="mea:WORKORDER"/>
</xsl:template>


<xsl:template match="mea:WORKORDER">
    <ExecuteMultipleOperations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <Operations>
            <Operation xmlns:xsd="http://www.w3.org/2001/XMLSchema">
                <Object>
                    <Object xsi:type="Task">
                        <xsl:apply-templates select="mea:WONUM" />
                        <xsl:call-template name="formatDateTime">
                        <xsl:with-param name="dateTime" select="mea:STATUSDATE" />
                        </xsl:call-template>
                        <xsl:call-template name="TLS"></xsl:call-template>
                        <xsl:apply-templates select="mea:FAILUREREPORT[mea:TYPE='PROBLEM']/mea:FAILURECODE" />
                        <xsl:apply-templates select="mea:FAILUREREPORT[mea:TYPE='CAUSE']/mea:FAILURECODE" />
                        <xsl:apply-templates select="mea:FAILUREREPORT[mea:TYPE='REMEDY']/mea:FAILURECODE" />
                        <xsl:call-template name="TLS2"></xsl:call-template>
                    </Object>
                </Object>
            </Operation>
        </Operations>   
    </ExecuteMultipleOperations>
</xsl:template>

<xsl:template match="mea:WONUM">
    <ExternalRefID><xsl:value-of select="." /></ExternalRefID>
    <Status>Completed</Status>
</xsl:template>
<xsl:template name="formatDateTime">
 <xsl:param name="dateTime" />
 <xsl:variable name="date">
 <xsl:value-of select="substring-before($dateTime, 'T')" />
 </xsl:variable>
 <xsl:variable name="time">
 <xsl:value-of select="substring-before(substring-after($dateTime, 'T'), '+')" />
 </xsl:variable>
 <CompletionDate><xsl:value-of select="concat($date,' ',$time)" /></CompletionDate>
</xsl:template>
<xsl:template name="TLS">
 <TLSMissedAppointmentReason></TLSMissedAppointmentReason>
 <TLSMissedCommitmentReason></TLSMissedCommitmentReason>
 <TLSAction></TLSAction>
</xsl:template>
<xsl:template match="mea:FAILUREREPORT[mea:TYPE='PROBLEM']/mea:FAILURECODE">
    <TLSClearanceCode1><xsl:value-of select="." /></TLSClearanceCode1>
</xsl:template>
<xsl:template match="mea:FAILUREREPORT[mea:TYPE='CAUSE']/mea:FAILURECODE">
    <TLSClearanceCode2><xsl:value-of select="." /></TLSClearanceCode2>
</xsl:template>
<xsl:template match="mea:FAILUREREPORT[mea:TYPE='REMEDY']/mea:FAILURECODE">
    <TLSClearanceCode3><xsl:value-of select="." /></TLSClearanceCode3>
</xsl:template>
<xsl:template name="TLS2">
 <TLSRestorationTime></TLSRestorationTime>
 <TLSCompletionRemarks></TLSCompletionRemarks>
</xsl:template>

As you could see above, I only have one namespace defined in my XSL like this

ExecuteMultipleOperations xmlns:xsi="w3.org/2001/XMLSchema-instance"

However, my output XML has 2 namespaces as below

ExecuteMultipleOperations xmlns:xsi="w3.org/2001/XMLSchema-instance" xmlns:mea="ibm.com/maximo"

Could I get rid of xmlns:mea="ibm.com/maximo"

1

1 Answers

0
votes

You haven't shown the context but as your stylesheet uses patterns like match="mea:FAILUREREPORT ... it would only work if it declares xmlns:mea="..." in some way and if you don't want or need that namespace for the result elements then you can add exclude-result-prefixes="mea" on the xsl:stylesheet or xsl:transform element.