on 10-07-2015 7:59 AM
Hi All,
how to remove xmlns in input xml. Because it's bring empty value when i call this in atoms
I find following xslt. Where i will use below xslt in atom
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:template match="*">
<xsl:element name="{local-name()}">
<xsl:apply-templates select="@* | node()"/>
</xsl:element>
</xsl:template>
<!-- template to copy attributes -->
<xsl:template match="@*">
<xsl:attribute name="{local-name()}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:template>.
This is my xml file.
?xml version="1.0" encoding="UTF-8"?>
<orders xmlns="http://www.fhjfsj.com/xml/duu/order/2010-10-31">
<order order-no="EU_325278">
<invoice-no>679900</invoice-no>
<customer>
</orders>
</order>
Output in next atom like that below
<orders>
<order order-no="EU_325278">
<invoice-no>679900</invoice-no>
<customer>
</orders>
Hi Narain,
try with this:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns="http://www.fhjfsj.com/xml/duu/order/2010-10-31" xmlns:b1e="urn:com.sap.b1i.sim:b1event" xmlns:b1ie="urn:com.sap.b1i.sim:b1ievent" xmlns:b1im="urn:com.sap.b1i.sim:b1imessage" xmlns:bfa="urn:com.sap.b1i.bizprocessor:bizatoms" xmlns:jdbc="urn:com.sap.b1i.adapter:jdbcadapter" xmlns:rfc="urn:sap-com:document:sap:rfc:functions" xmlns:sim="urn:com.sap.b1i.sim:entity" xmlns:utils2="com.sap.b1i.bpc_tools.Utilities" xmlns:vpf="urn:com.sap.b1i.vplatform:entity" xmlns:xci="urn:com.sap.b1i.xcellerator:intdoc" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" bfa:force="" vpf:force="" jdbc:force="" rfc:force="" b1ie:force="" b1e:force="" xci:force="" sim:force="" utils2:force="" b1im:force="">
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:param name="atom"/>
<xsl:param name="sessionid"/>
<xsl:variable name="msg" select="/vpf:Msg/vpf:Body/vpf:Payload[./@Role='S']"/>
<xsl:variable name="vpSender" select="/vpf:Msg/vpf:Header/vpf:Sender/@Id"/>
<xsl:variable name="vpObject" select="/vpf:Msg/vpf:Header/vpf:Sender/@ObjId"/>
<xsl:variable name="vpReceiver" select="/vpf:Msg/vpf:Header/vpf:ReceiverList/vpf:Receiver[./@handover='P']/@Id"/>
<xsl:template match="/">
<Msg xmlns="urn:com.sap.b1i.vplatform:entity">
<xsl:copy-of select="/vpf:Msg/@*"/>
<xsl:copy-of select="/vpf:Msg/vpf:Header"/>
<Body>
<xsl:copy-of select="/vpf:Msg/vpf:Body/*"/>
<Payload Role="R" id="{$atom}">
<xsl:call-template name="transform"/>
</Payload>
</Body>
</Msg>
</xsl:template>
<xsl:template name="transform">
<xsl:apply-templates select="$msg/*"/>
</xsl:template>
<xsl:template match="@* | node()">
<xsl:choose>
<xsl:when test="string-length(namespace-uri()) > 0">
<xsl:element name="{local-name()}" xmlns="">
<xsl:apply-templates select="@* | node()"/>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Sender's Payload:
<?xml version="1.0" encoding="UTF-8"?>
<orders xmlns="http://www.fhjfsj.com/xml/duu/order/2010-10-31">
<order order-no="EU_325278">
<invoice-no>679900</invoice-no>
</order>
</orders>
result Message:
<Msg xmlns="urn:com.sap.b1i.vplatform:entity" MessageId="15101115591055522913C0A8087A2239" BeginTimeStamp="20151011155910" logmsg="0000" SubMessageId="" status="success" owntst="true" test="true">
<Header>
<IPO Id="vPlatform_Test"/>
<Sender Id="" ObjId="DTL.TestXmlns"/>
<Receiver Id=""/>
<ReceiverList>
<Receiver Id="" handover="P"/>
</ReceiverList>
<Identification Ident="Void" IdPar="n.a."/>
<nsList/>
<vBIU Id="DTL.TestXmlns" ver="1.0.0" SId="DTL.ImportTdb" filter="" phase=""/>
<Variables>
<var id="userid" value=""/>
<var id="username" value=""/>
</Variables>
<Properties/>
<SysTypeProperties type="B1if" offline="" snd="senderdummy" rcv="receiverdummy" ssystype="" rsystype=""/>
<LocalProperties type="B1if" biu="DTL.TestXmlns" snd="senderdummy" rcv="receiverdummy" sid="DTL.ImportTdb" offline=""/>
<VarProperties/>
</Header>
<Body>
<Payload Role="T" Type="Call"/>
<Payload Role="S">
<orders xmlns="http://www.fhjfsj.com/xml/duu/order/2010-10-31">
<order order-no="EU_325278">
<invoice-no>679900</invoice-no>
</order>
</orders>
</Payload>
<Payload Role="R" id="atom0">
<orders xmlns="">
<order order-no="EU_325278">
<invoice-no>679900</invoice-no>
</order>
</orders>
</Payload>
</Body>
</Msg>
Hope this helps.
Regards
Pierre
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Any Help?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Check this:
xslt - How to &#39;select&#39; from XML with namespaces? - Stack Overflow
then...
modify your stylesheet adding name for your namespace (here 'order') for example like this:
<xsl:stylesheet xmlns:order="http://www.fhjfsj.com/xml/duu/order/2010-10-31" xmlns:b1e="urn:com.sap.b1i.sim:b1event" [other namespaces...] />
then your select should look like this:
<xsl:value-of select="/vpf:Msg/vpf:Body/vpf:Payload[./@Role='S']/order:orders/order:order/@order-no" />
Kind regards,
Radek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Thanks for youre replies. this is also not working for me.
Please any one advice how i include the below code in atom and get result. The below lines bring output in xml editor. So how i use this below code in atom
<xsl:template match="*"> |
<xsl:element name="{local-name()}">
<xsl:apply-templates select="@* | node()"/>
</xsl:element>
</xsl:template>
<xsl:template match="@* | text() | comment() | processing-instruction()"> |
<xsl:copy/>
</xsl:template>
Any solutons?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
why are you copying the attributes, if you don't need them?
Just leave your "copy attributes" segment away and the namespace will not be copied.
In case you need some other attributes (not the namespaces) you could alternatively set following attribute xmlns="" into your element.
Best regards
Bastian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi bastian,
i parse the value from xml. it's show empty. i used below xpath
/vpf:Msg/vpf:Body/vpf:Payload[./@Role='S']/orders/order/@order-no
xml file
?xml version="1.0" encoding="UTF-8"?>
<orders xmlns="http://www.fhjfsj.com/xml/duu/order/2010-10-31">
<order order-no="EU_325278">
<invoice-no>679900</invoice-no>
<customer>
</orders>
</order>
but when i change xml file and read the data it's comes correctly. So i want remove xmlns.
?xml version="1.0" encoding="UTF-8"?>
<orders>
<order order-no="EU_325278">
<invoice-no>679900</invoice-no>
<customer>
</orders>
</order>
HI,
is this a DMEE payment file?
regards
sinu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
100 | |
11 | |
11 | |
6 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.