I mean how to extract the namespace of xml by using xslt through xpath. is it is possible?

gayathri grandhe
gayathri grandhe used Ask the Experts™
on
I mean how to extract the namespace of xml by using xslt through xpath. is it is possible?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Gertone (Geert Bormans)Information Architect
Top Expert 2006

Commented:
for this XML

<foo xmlns="abc">
    
</foo>

Open in new window


this template will give the namespace uri for the nodes

   <xsl:template match="node()">
        <xsl:value-of select="namespace-uri()"/>
    </xsl:template>

Open in new window


I assume that is what you need
(try to be more specific in your questions: xslt version, specific requirement.... this seems like homework without context)

Author

Commented:
I don't need namespace for a particular node.
I mean in the xml
these are the namespaces

<?xml-stylesheet type="text/xsl" href="update.xsl"?>
<insurance xsi:schemaLocation="http://redbus.com/service/kbs/Integration C:/DOCUME~1/AXSURY/MYDOCU~1/ACES/Design/XSLT/Update/Create_intellengent.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://redbus.com/service/kbs/Integration">

how to extract this namespace.
could you please suggest me in that.

Author

Commented:
how to extract that by using xpath
Information Architect
Top Expert 2006
Commented:
to find the namespace uri of the root node

        <xsl:value-of select="namespace-uri(/*)"/>
Gertone (Geert Bormans)Information Architect
Top Expert 2006

Commented:
completely answered.
Relevant for the knowledge database since it is a generic question and dito solution

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial