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 106991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:41:02+00:00 2026-05-11T01:41:02+00:00

I am looking for a XSL snippet that simply returns the XML unaltered. It

  • 0

I am looking for a XSL snippet that simply returns the XML unaltered. It sounds trivial but I can’t seem to find an example anywhere on the web. Any help out there?

  • 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. 2026-05-11T01:41:02+00:00Added an answer on May 11, 2026 at 1:41 am

    In order to copy the complete XML document, it is necessary to have a template that matches the root. This might be:

         <xsl:template match='/'>

    or

         <xsl:template match='node()'>

    Then a single copying of the current node (the root node) is just sufficient:

         <xsl:copy-of select=’.’/>

    So, one such complete transformation is:

    <xsl:stylesheet version='1.0'  xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>     <xsl:template match='/'>       <xsl:copy-of select='.'/>     </xsl:template> </xsl:stylesheet> 

    Although this is probably the simplest such transformation, XSLT programmers use another one, widely known as the identity transformation or the identity rule:

    <xsl:stylesheet version='1.0'  xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>     <xsl:template match='node()|@*'>       <xsl:copy>         <xsl:apply-templates select='node()|@*'/>       </xsl:copy>     </xsl:template> </xsl:stylesheet> 

    The reson the identity transformation is considered to be one the most fundamental XSLT design patterns and to be so massively used, is that by overriding this template rule with other, more specific templates, one can very easily perform a variety of operations that otherwise will be difficult. Examples are deleting a particular (set of) element(s) that have a specific name or satisfy some other condition, renaming particular elements, changing the namespace of particular elements, creating new children or siblings of particular elements, …, etc.

    For more information and code snippets using the identity transformation, do look here.

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

Sidebar

Related Questions

I'm looking for an example maven pom that will generate a PDF document from
I know that XSLT itself has attribute-sets, but that forces me to use <xsl:element
Helo, i am looking to do a search function in xsl to find a
I'm looking to do some really simply XSLT on my XML document, which has
I'm basically looking for the opposite of this An example of the XML I'm
I'm looking for a concrete example of an XSL stylesheet storing the current working
I'm using XSL-FO with Apache FOP to take a sexy looking XML file and
Looking for a perl one-liner what will find all words with the next pattern:
Looking for a control that allows to select one text value at a time
Looking to use XSLT to transform my XML. The sample XML is as follows:

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.