Skip to Content
author's profile photo Former Member
Former Member

xmlns in root element

When converting exchange rates xml from

I'm getting problem with xmlns in root element.

CALL TRANSFORMATION triggers CX_XSLT_ABAP_CALL_ERROR, but only if there is xmlns attribute in first line in input xml:" xmlns="">

Without this xmlns=..... (or when modifying e.g. abcxmlns= ) works following xslt fine:" xmlns:sap="" version="1.0">

<xsl:strip-space elements="*"/>

<xsl:template match="/">





<xsl:template match="Cube/Cube">" version="1.0">



<xsl:value-of select="@time"/>



<xsl:apply-templates select="Cube"/>





<xsl:template match="Cube/Cube/Cube">



<xsl:value-of select="1"/>



<xsl:value-of select="@currency"/>



<xsl:value-of select="@rate"/>





I'd appreciate if someone migh advise me how to alternate the xslt or tell me what the xmlns in input does.


Edited by: Viktor Kunc on Sep 29, 2008 3:25 PM

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jul 24, 2012 at 11:53 AM

    Hi Viktor,

    I have same problem. do you solve it?



    Add a comment
    10|10000 characters needed characters exceeded

    • If a namespace is specified on root level, it propagates down to all children, see:

      The namespace is part of a name. So, if you have an element <Cube> as child of the root element <root xmlns="">, then

      <xsl:apply-templates select="Cube"/>

      won't be applied, since the qualified name of the element is not Cube but {}Cube

      If you want the XSLT to work with and without namespace equally well, you have to work with local names in XPath expressions:

      <xsl:apply-templates select="local-name() = 'Cube'"/>

      The same holds for all XPath functions working with element names.

      Usually, however, the namespace is part of the contract with the client and is

      • either obligatory to be used
      • or obligatory to be omitted.

      But not both.



Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.