0

I need a help on XQuery where I am receiving a XML SOAP envelop body from external system and now I have to route the data based on namespace in XML.

like below

<v1:EmployeeResponse xmlns:v1="http://test.service.net/com/v1">
    <v1:Reference>SequenceTime="2019-03-07 12.15.01.970236"</v1:Reference>
    <v1:Details>
        <v1:Name>
            <v1:FirstName>Alex</v1:FirstName>
        </v1:Name>
    </v1:Details>
</v1:EmployeeResponse>

here say I am getting namesace as http://test.service.net/com/v1 then i should update a temp variable says v1 and if this is http://test.service.net/com/v2, the variable should be v2.

I am more curious to know how i can read a namespace from the XML document using Xquery or XSLT.

1
  • 1
    There is a namespace-uri function defined in XPath and therefore also XSLT/XQuery that allows you to read out the namespace of a node in an XML document: w3.org/TR/xpath-functions/#func-namespace-uri. I am not sure what you consider a "temp variable" in XSLT or XQuery. Commented Jul 16, 2019 at 7:46

1 Answer 1

1

namespace-uri(/*) will give you the namespace of the outermost element of the document.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.