cancel
Showing results for 
Search instead for 
Did you mean: 

Handling xml:lang tag in cXML for Ariba

manikandan_shanmugam3
Active Participant
0 Kudos

Hi All,

I have created scenario to push cXML to Ariba.

Ariba expects a tag in the format xml:lang (mentioned below)but HCI generates only as lang which cause message failure while pushing message to ariba.

Expected: <Description xml:lang="en"/>

Generated: <Description lang="en"/>

WSDL reference used in HCI mapping:

<xsd:element name="Description" form="qualified">

<xsd:complexType>

<xsd:simpleContent>

<xsd:extension base="xsd:string"><xsd:attribute ref="xml:lang"/></xsd:extension>

Please let me know how to achive it.

Accepted Solutions (0)

Answers (4)

Answers (4)

Sriprasadsbhat
Active Contributor
0 Kudos

Hello Mani,

Below XSLT will do the requirement.

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="node()|@*">
        <xsl:copy>
            <xsl:apply-templates select="node()|@*"/>
        </xsl:copy>
    </xsl:template>
    <xsl:template match="@lang">
        <xsl:attribute name="xml:lang">
            <xsl:value-of select="."/>
        </xsl:attribute>
    </xsl:template>
</xsl:stylesheet>


Regards,

Sriprasad Shivaram Bhat

manikandan_shanmugam3
Active Participant
0 Kudos

Hi Prasad,

Please find input and output xml. As this is required for HCI, I am fine to go with XSLT, groovy or javascript to achieve this.

For example:

Input:

    <?xml version="1.0" encoding="UTF-8"?>
    <root>
    <Description lang="en">TEST</Description>
    <Forecast>
    <Period endDate="2016-09-01T23:59:59+02:00" startDate="2016-09-01T00:00:00+02:00"/>
    <ForecastQuantity quantity="34.0">
    <name lang="en">TEST1</name>
    <UnitOfMeasure>EA</UnitOfMeasure>
    </ForecastQuantity>
    </Forecast>
    </root>

Output:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.029/cXML.dtd">
    <root>
    <Description xml:lang="en">TEST</Description>
    <Forecast>
    <Period endDate="2016-09-01T23:59:59+02:00" startDate="2016-09-01T00:00:00+02:00"/>
    <ForecastQuantity quantity="34.0">
    <name xml:lang="en">TEST1</name>
    <UnitOfMeasure>EA</UnitOfMeasure>
    </ForecastQuantity>
    </Forecast>
    </root>
Sriprasadsbhat
Active Contributor
0 Kudos

Hello Mani,

It would be great if you can paste or attach the XML ( Expected and Generated ) so that it will be easier to give some solution on that.

Regards,

Sriprasad Shivaram Bhat

manikandan_shanmugam3
Active Participant
0 Kudos

Hi Sriprasad,

Can you check my input and output sample and suggest to achieve the same?

Regards,

Mani

manikandan_shanmugam3
Active Participant
0 Kudos

Hi All,

Can you please let me know if you have any XSL code to achieve it?

Regards,

Mani