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

  • SEARCH
  • Home
  • 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 6875073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:16:29+00:00 2026-05-27T04:16:29+00:00

Source file <?xml version=1.0 encoding=UTF-8?> <!–It will contain more data, just given few here–>

  • 0

Source file

<?xml version="1.0" encoding="UTF-8"?>
<!--It will contain more data, just given few here-->
<Food>
<Menu>Item1</Menu>
</Food>

Require output:

<?xml version="1.0" encoding="UTF-8"?>
<Detail>
<SubDetail>
<Food>
<Menu>Item1</Menu>
</Food>
</SubDetail>
</Detail>

I would like to add the source xml(contains more than 200 lines) in between Detail and SubDetails. Could you please tell me how to write the xslt.

  • 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-05-27T04:16:30+00:00Added an answer on May 27, 2026 at 4:16 am

    Just stating the obvious: Instead of explicit recursive copying, you could also use <xsl:copy-of> command if you want to copy the selected node and all of its contents. Copying the whole input document inside <Detail> and <SubDetail> wrapper element can be done with one xsl command within one template. Your final use case is probably more complex, but the logic is the same.

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    
    <xsl:output indent="yes" omit-xml-declaration="no" encoding="UTF-8"/>
    
    <xsl:template match="/">
        <Detail>
            <SubDetail>
                <xsl:copy-of select="."/>
            </SubDetail>
        </Detail>
    </xsl:template>
    
    </xsl:stylesheet>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a bit o' trouble... Here is my mappings.xml file... <?xml version=1.0 encoding=utf-8?>
Source xml file: <?xml version=1.0 encoding=UTF-8 standalone=yes?> <!-- Inbound Message --> <Sales xmlns=abc:org.xcbl:schemas/xcbl/v4/xcbl4.xsd xmlns:SOAP-ENV=http://www.w3.org/2003/05/soap-envelope
I'm working on XSLT. I have this XML source file : <?xml version=1.0 encoding=UTF-8?>
I have Data.xml: <?xml version=1.0 encoding=utf-8 ?> <data> <album> <slide title=Autum Leaves description=Leaves from
My XML File is stored in oracle column <?xml version=1.0 encoding=UTF-8?> <BasicProductTemplateType xmlns=http://www.asia.com/app/Product_2_0 xmlns:jBos_Common_1_0=http://www.asia.com/jBos/Common_1_0>
I have the following config for persistence.xml file: <?xml version=1.0 encoding=UTF-8?> <persistence xmlns=http://java.sun.com/xml/ns/persistence xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
I've got the following xml file: <?xml version=1.0 encoding=utf-8?> <Project ToolsVersion=4.0 DefaultTargets=DeployPrototype xmlns=http://schemas.microsoft.com/developer/msbuild/2003> <PropertyGroup>
Following is sample XML File - <?xml version=1.0 encoding=UTF-8?> <Catalog> <Book> <AName>Steven Holzner</AName> <BName>Using
I have an XML file of the following structure: <?xml version=1.0 encoding=utf-8?> <root> <ArrayOfLocationDTO
I have AJAX call to one XML file and the source code is given

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.