Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8661645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:32:49+00:00 2026-06-12T16:32:49+00:00

My input xml would be like this with json namespaces.. <json:object xmlns:json=http://www.ibm.com/xmlns/prod/2009/jsonx xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance> <json:object

  • 0

My input xml would be like this with json namespaces..

<json:object xmlns:json="http://www.ibm.com/xmlns/prod/2009/jsonx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <json:object name="Login">
        <json:object name="Group">
            <json:object name="TargetSystem">
                <json:string name="Name">john</json:string>
                <json:string name="Password"/>
            </json:object>
        </json:object>
    </json:object>
</json:object>

I need the output like this

<Login>
    <Group>
        <TargetSystem>
            <Name>john</Name>
            <Password/>
        </TargetSystem>
    </Group>
</Login>

I have to create this xml using the attribute name value in the input xml using xslt.
I am using the below xslt.

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:json="http://www.ibm.com/xmlns/prod/2009/jsonx">
    <xsl:output method="xml" indent="yes" omit-xml-declaration="no"/>
    <xsl:template match="/">

        <xsl:apply-templates select="json:object/*"/>
    </xsl:template>
    <xsl:template match="json:object">
        <xsl:element name="{@name}">
            <xsl:value-of select="."/>
        </xsl:element>
    </xsl:template>
</xsl:stylesheet>

Using this I am getting only john.
I have to use some looping concept..
Could anyone please help me how can I achieve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T16:32:50+00:00Added an answer on June 12, 2026 at 4:32 pm

    If minimal XSLT is your thing, it is possible to come up with a generic XSLT that would work with any namespace.

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
       <xsl:output method="xml" indent="yes" omit-xml-declaration="no"/>
    
       <xsl:template match="*[@name]">
          <xsl:element name="{@name}">
           <xsl:apply-templates/>
          </xsl:element>
       </xsl:template>
    </xsl:stylesheet>
    

    In other words, this will match any element with a @name attribute, and create an element of that name instead. Because the root element has no such attribute, it won’t be output, but the default template match will just continue to process its children.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Input is a URL like this http://ws.geonames.org/children?geonameId=6255148 and I would like to receive the
The input XML tag must be validated for a pattern which is like this:
I'm getting XML input that looks like this <?xml version=1.0 encoding=utf-8?> <data1>this is data
I have an input XML document something like this: <text> <p> Download the software
I have a XML that looks like this (arbitrary XML input) <NodeLevel1> <NodeLevel2> <NodeLevel3>
Trying to parse xml to text I got something like this, INPUT FILE <Item
I've basically got an XML input structure like this: ... <box type=rectangle class=someOriginalClass> <background
This is my input xml. The xml can have maximunm three nodes and minimum
This is my input xml: <root> <node1/> <node2/> <node3/> <node4/> <othertags/> </root> The output
I have a form with several input fields, i would like to go through

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.