Add namespace prefix using XSL

Posted on 2008-11-06
Last Modified: 2013-11-18
I wanted to know whether it would be possible to apply namespace prefix to all the nodes within a given xml?

For example I want to convert the following xml

<s:head xmlns:s="hello"><s:child1></s:child1></s:head>
Question by:pattabi23in
    LVL 60

    Accepted Solution

    one way to do this
    <xsl:stylesheet xmlns:xsl="" version="1.0" xmlns:s="hello">
        <xsl:template match="*">
            <xsl:element name="s:{local-name()}">
                <xsl:apply-templates select="node()"/>

    Open in new window


    Author Closing Comment

    Thank you very much.
    LVL 60

    Expert Comment

    by:Geert Bormans

    Featured Post

    Gigs: Get Your Project Delivered by an Expert

    Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

    Join & Write a Comment

    Preface In the first article: A Better Website Login System ( I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
    Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System ( introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
    Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now