Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

simple transformation: xmlns="" in output

Former Member
0 Kudos
945

Hey,

I created this simple transormation Z1


<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">

  <tt:root name="REPORT"/>
  <tt:root name="R0390"/>

  <tt:template>
    <cssr_document xmlns="http://www.nbb.be/cssr">

      <content xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CPAAcquisitionDataset">
        <survey> <tt:attribute name="code" value-ref="report"/> 
          <form code="0390">
            <tt:call transformation="Z2">
              <tt:with-root name="ROOT" ref="R0390"/>
            </tt:call>
          </form>
        </survey>
      </content>
    </cssr_document>
  </tt:template>
</tt:transform>

that as you see calls another transformation Z2:


<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates" xmlns:ss="cc">


  <tt:root name="ROOT"/>

  <tt:template>

    <tt:loop ref=".ROOT">
      <item>
        <tt:s-cond check="not-initial($REF.Rubriek)" using="exist($REF.Rubriek)">
          <tt:attribute name="C013" value-ref="$REF.Rubriek"/>
        </tt:s-cond>
      </item>
    </tt:loop>

  </tt:template>

</tt:transform>

In the output I the element <item> gets the attribute xmlns="" and I have no idea where it comes from, and worse: I have no idea to remove it...


<?xml version="1.0" encoding="iso-8859-1"?>
<cssr_document xmlns="http://www.nbb.be/cssr">
<survey code="S10INS">
<form code="0390"><item xmlns="" C013="1234" />  </form>
  </survey>
  </content>
  </cssr_document>

Someone an idea how I can avoid this attribute?

7 REPLIES 7

Former Member
0 Kudos
180

Found the solution: by trial-and-error I detected that the xmlns-definition in the primary template caused the problem.

When I dropped that argument the empty xmlns-attribute was not there.

But that argument is needed for the receiving party, so I tried several stuff: And here is the trick: put it between single quotes ' instead of double qoutes "


<cssr_document xmlns='http://www.nbb.be/cssr'>

The result in the xml is still double quotes:


<?xml version="1.0" encoding="iso-8859-1" ?> 
  <cssr_document xlmns="http://www.nbb.be/cssr">

Former Member
0 Kudos
180

The problem is not solved, I have a typo in the cssr_document-element.

0 Kudos
180

Hi,

I don't understand why you think double quote is an issue!?

Sandra

0 Kudos
180

Sandra,

it is not an issue, but it was one of the many things I tried. Thought it was the solution but I typed xlmns instead of xmlns.

I found the same question on the forum but no answer yet:

Also similar but this is but with XLST

http://www.stylusstudio.com/ssdn/default.asp?action=9&fid=23&read=4028

Any suggestions?

Renaat

0 Kudos
180

Hi Renaat,

I reproduced on my system


data a type i.
Data xml type string.
a = 179.
CALL TRANSFORMATION Z1 SOURCE root = a RESULT XML xml.
write / xml.

Z1:


<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
<tt:root name="ROOT"/>
<tt:template>
  <cssr_document xmlns="http://www.nbb.be/cssr">
            <tt:call transformation="Z2">
                        <tt:with-root name="ROOT" ref="ROOT"/>
            </tt:call>
    </cssr_document>
</tt:template>
</tt:transform>

Z2:


<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
  <tt:root name="ROOT"/>
  <tt:template>
    <AA>
      <tt:value ref=".ROOT"/>
    </AA>
  </tt:template>
</tt:transform>

Result:


<?xml version="1.0"?><cssr_document xmlns="http://www.nbb.be/cssr"><AA xmlns="">179</AA></cssr_document>

I have made a few tests, and it seems that namespaces are not passed between transformations, but the system detects that the transformation is being called from another one which has a default namespace and cancels it by xmlns="".

So, I think you either need to redeclare the namespace in the second transformation (unfortunately, that will add xmlns="uri" a second time, but that doesn't make the resulting XML wrong), or instead of calling the transformation, you may include it (<tt:include>).

Sandra

0 Kudos
180

Hey Sandra,

the solution by declaring a namespace in the called transformation can be a solution, the extra xmlns="uri" is maybe correct xml but the receiver of our xml (that is a governmental organisation) can not confirm that. And we very little test-capacity (on their side).

Using an included template seems to give the same result as the calling.

So because the limited resources and I only use the reusable part 4x I just copied it 4 times.

You are very thankfull for your help, but after me this is an issue in the SAP simple transformation solution and I hope they solve this.

kind regards,

Renaat

0 Kudos
180

Hi,

In case SAP doesn't have an immediate solution, the workaround is to simply remove (REPLACE statement) duplicate xmlns="uri" occurrences after the CALL TRANSFORMATION.

Sandra