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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:05:53+00:00 2026-05-18T04:05:53+00:00

I have an XML File <?xml version=1.0 encoding=UTF-8?> <data> <contact-information> <full-name>Peter John</full-name> <address_line_1>some place</address_line_1>

  • 0

I have an XML File

<?xml version="1.0" encoding="UTF-8"?>
<data>

 <contact-information>

  <full-name>Peter John</full-name>
  <address_line_1>some place</address_line_1>
  <address_line_2>some place2</address_line_2>
  <city>some city</city>
  <state>some state</state>
  <zip>54000</zip>
  <country>some country</country>
  <phone>2121314144</phone>
  <email>abc@xyz.com</email>

</contact-information>

<professional-experience-section>
  <section-name>PROFESSIONAL EXPERIENCE</section-name>
  <enabled>true</enabled>
  <company>
    <name>Computer Sciences Corporation</name>
    <city>New York</city>
    <state>NY</state>
    <country>United States</country>
    <job-title>
      <title>Senior Software Engineer</title>
      <start-date>Aug 1996</start-date>
      <end-date>May 2010</end-date>
      <ongoing>false</ongoing>
      <job-description>
        <bullet-point>
          <statement>C#, Visual Basic, Asp.net</statement>
        </bullet-point>
        <bullet-point>
          <statement>Inspect completed work to ensure conformance to specifications, standards, and contract requirements.</statement>
        </bullet-point>
        <bullet-point>
          <statement>Another Work Description.</statement>
        </bullet-point>
      </job-description>
    </job-title>
  </company>
  <company>
    <name>Acme</name>
    <city>Silver Spring</city>
    <state>MD</state>
    <country>United States</country>
    <job-title>
      <title>Manager</title>
      <start-date>Jul 2010</start-date>
      <end-date>present</end-date>
      <ongoing>true</ongoing>
      <job-description>
        <bullet-point>
          <statement>Report to management regarding the finances of establishment.</statement>
        </bullet-point>
        <bullet-point>
          <statement>Prepare, examine, or analyze accounting records, financial statements, or other financial reports to assess accuracy, completeness, and conformance to reporting and procedural standards.</statement>
        </bullet-point>
        <bullet-point>
          <statement>Prepare, examine, or analyze accounting records, financial statements, or other financial reports to assess accuracy, completeness, and conformance to reporting and procedural standards.</statement>
        </bullet-point>
      </job-description>
    </job-title>

    <job-title>
      <title>Analyst</title>
      <start-date>Jul 2001</start-date>
      <end-date>Jan 2010</end-date>
      <ongoing>false</ongoing>
      <job-description>
        <bullet-point>
          <statement>Study and rehearse roles from scripts in order to interpret, learn and memorize lines, stunts, and cues as directed.</statement>
        </bullet-point>
        <bullet-point>
          <statement>Work closely with directors, other actors, and playwrights to find the interpretation most suited to the role.</statement>
        </bullet-point>
      </job-description>
    </job-title>

  </company>
</professional-experience-section>


<education-section>
  <section-name>EDUCATION</section-name>
  <enabled>true</enabled>
  <institution>
    <name>Allston Community College</name>
    <city>Akron</city>
    <state>MA</state>
    <country>United States</country>
    <degree>Bachelor of Art in Marketing Candidate</degree>
    <end-date>Jan 2020</end-date>
    <ongoing>true</ongoing>
    <expected-completion-date>Jan 2020</expected-completion-date>
    <completed></completed>
    <bullet-point>
      <statement>detail of what i did at the allston community college</statement>
    </bullet-point>
  </institution>
  <institution>
    <name>Boston College</name>
    <city>Boston</city>
    <state>MA</state>
    <country>United States</country>
    <degree>Bachelor of Science in Information Systems</degree>
    <end-date>Jul 1990</end-date>
    <ongoing>false</ongoing>
    <expected-completion-date></expected-completion-date>
    <completed>true</completed>
    <bullet-point>
      <statement>Lorem Ipsum</statement>
    </bullet-point>
  </institution>
  <institution>
    <name>Testing</name>
    <city>Testing</city>
    <state>PA</state>
    <country>United States</country>
    <degree>Completed coursework towards Bachelor of Art in Marketing</degree>
    <end-date>Mar 1963</end-date>
    <ongoing>false</ongoing>
    <expected-completion-date></expected-completion-date>
    <completed>false</completed>
    <bullet-point>
      <statement>Lorem Ipsum</statement>
    </bullet-point>
  </institution>
  <institution>
    <name>Testing</name>
    <city>Testing</city>
    <state>PA</state>
    <country>United States</country>
    <degree>Completed coursework towards Bachelor of Art in Marketing</degree>
    <end-date>Mar 1963</end-date>
    <ongoing>false</ongoing>
    <expected-completion-date></expected-completion-date>
    <completed>false</completed>
    <bullet-point>
      <statement>Lorem Ipsum</statement>
    </bullet-point>
  </institution>
</education-section>
<additional-skills-section>
  <section-name>ADDITIONAL SKILLS</section-name>
  <enabled>true</enabled>
  <layout>1 Column</layout>
  <bullet-point>
    <statement>Additional Skills 1</statement>
  </bullet-point>
   </additional-skills-section>
<custom-section>
  <section-name>PUBLICATIONS</section-name>
  <layout>2</layout>
  <bullet-point>
    <statement>test</statement>
  </bullet-point>
 </custom-section>

</data>

As you can see this file contains different sections, contact-information, professional and education?

I want to sort these sections using xsl.

By sorting i mean that i want the professional section to appear first in the transformed xml when xsl transformation is applied.

How can i do that in xsl? How are xml elements parsed? Meaning priority?

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

    This transformation:

    <xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:output omit-xml-declaration="yes" indent="yes"/>
     <xsl:strip-space elements="*"/>
    
     <xsl:param name="pRanks">
      <professional-experience-section r="1"/>
      <education-section r="2"/>
      <additional-skills-section r="3"/>
      <custom-section r="4"/>
      <contact-information r="5"/>
     </xsl:param>
    
     <xsl:variable name="vRanks" select=
         "document('')/*/xsl:param[@name='pRanks']"/>
    
     <xsl:template match="node()|@*">
      <xsl:copy>
       <xsl:apply-templates select="node()|@*"/>
      </xsl:copy>
     </xsl:template>
    
     <xsl:template match="/*">
      <xsl:apply-templates select="*">
       <xsl:sort select="$vRanks/*[name()=name(current())]/@r"
                 data-type="number"/>
      </xsl:apply-templates>
     </xsl:template>
    </xsl:stylesheet>
    

    when applied on the provided XML document, produces the sorted result as per the rankings specified in the pRanks parameter:

    <professional-experience-section>
       <section-name>PROFESSIONAL EXPERIENCE</section-name>
       <enabled>true</enabled>
       <company>
          <name>Computer Sciences Corporation</name>
          <city>New York</city>
          <state>NY</state>
          <country>United States</country>
          <job-title>
             <title>Senior Software Engineer</title>
             <start-date>Aug 1996</start-date>
             <end-date>May 2010</end-date>
             <ongoing>false</ongoing>
             <job-description>
                <bullet-point>
                   <statement>C#, Visual Basic, Asp.net</statement>
                </bullet-point>
                <bullet-point>
                   <statement>Inspect completed work to ensure conformance to specifications, standards, and contract requirements.</statement>
                </bullet-point>
                <bullet-point>
                   <statement>Another Work Description.</statement>
                </bullet-point>
             </job-description>
          </job-title>
       </company>
       <company>
          <name>Acme</name>
          <city>Silver Spring</city>
          <state>MD</state>
          <country>United States</country>
          <job-title>
             <title>Manager</title>
             <start-date>Jul 2010</start-date>
             <end-date>present</end-date>
             <ongoing>true</ongoing>
             <job-description>
                <bullet-point>
                   <statement>Report to management regarding the finances of establishment.</statement>
                </bullet-point>
                <bullet-point>
                   <statement>Prepare, examine, or analyze accounting records, financial statements, or other financial reports to assess accuracy, completeness, and conformance to reporting and procedural standards.</statement>
                </bullet-point>
                <bullet-point>
                   <statement>Prepare, examine, or analyze accounting records, financial statements, or other financial reports to assess accuracy, completeness, and conformance to reporting and procedural standards.</statement>
                </bullet-point>
             </job-description>
          </job-title>
          <job-title>
             <title>Analyst</title>
             <start-date>Jul 2001</start-date>
             <end-date>Jan 2010</end-date>
             <ongoing>false</ongoing>
             <job-description>
                <bullet-point>
                   <statement>Study and rehearse roles from scripts in order to interpret, learn and memorize lines, stunts, and cues as directed.</statement>
                </bullet-point>
                <bullet-point>
                   <statement>Work closely with directors, other actors, and playwrights to find the interpretation most suited to the role.</statement>
                </bullet-point>
             </job-description>
          </job-title>
       </company>
    </professional-experience-section>
    <education-section>
       <section-name>EDUCATION</section-name>
       <enabled>true</enabled>
       <institution>
          <name>Allston Community College</name>
          <city>Akron</city>
          <state>MA</state>
          <country>United States</country>
          <degree>Bachelor of Art in Marketing Candidate</degree>
          <end-date>Jan 2020</end-date>
          <ongoing>true</ongoing>
          <expected-completion-date>Jan 2020</expected-completion-date>
          <completed/>
          <bullet-point>
             <statement>detail of what i did at the allston community college</statement>
          </bullet-point>
       </institution>
       <institution>
          <name>Boston College</name>
          <city>Boston</city>
          <state>MA</state>
          <country>United States</country>
          <degree>Bachelor of Science in Information Systems</degree>
          <end-date>Jul 1990</end-date>
          <ongoing>false</ongoing>
          <expected-completion-date/>
          <completed>true</completed>
          <bullet-point>
             <statement>Lorem Ipsum</statement>
          </bullet-point>
       </institution>
       <institution>
          <name>Testing</name>
          <city>Testing</city>
          <state>PA</state>
          <country>United States</country>
          <degree>Completed coursework towards Bachelor of Art in Marketing</degree>
          <end-date>Mar 1963</end-date>
          <ongoing>false</ongoing>
          <expected-completion-date/>
          <completed>false</completed>
          <bullet-point>
             <statement>Lorem Ipsum</statement>
          </bullet-point>
       </institution>
       <institution>
          <name>Testing</name>
          <city>Testing</city>
          <state>PA</state>
          <country>United States</country>
          <degree>Completed coursework towards Bachelor of Art in Marketing</degree>
          <end-date>Mar 1963</end-date>
          <ongoing>false</ongoing>
          <expected-completion-date/>
          <completed>false</completed>
          <bullet-point>
             <statement>Lorem Ipsum</statement>
          </bullet-point>
       </institution>
    </education-section>
    <additional-skills-section>
       <section-name>ADDITIONAL SKILLS</section-name>
       <enabled>true</enabled>
       <layout>1 Column</layout>
       <bullet-point>
          <statement>Additional Skills 1</statement>
       </bullet-point>
    </additional-skills-section>
    <custom-section>
       <section-name>PUBLICATIONS</section-name>
       <layout>2</layout>
       <bullet-point>
          <statement>test</statement>
       </bullet-point>
    </custom-section>
    <contact-information>
       <full-name>Peter John</full-name>
       <address_line_1>some place</address_line_1>
       <address_line_2>some place2</address_line_2>
       <city>some city</city>
       <state>some state</state>
       <zip>54000</zip>
       <country>some country</country>
       <phone>2121314144</phone>
       <email>abc@xyz.com</email>
    </contact-information>
    

    Do note: The $pRanks parameter can be specified externally so that the transformation will never need to be edited.

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

Sidebar

Related Questions

I have an XML file that looks like <?xml version='1.0' encoding='UTF-8'?> <root> <node name=foo1
I have the following XML file: <xml version=1.0 encoding=utf-8?> <Data> <Parameter1>1</Parameter1> </Data> I want
I have an xml file that contains this data: `<?xml version=1.0 encoding=UTF-8?> <WordList> <Words
I have this XML at http://localhost/file.xml : <?xml version=1.0 encoding=utf-8?> <val:Root xmlns:val=http://www.hw-group.com/XMLSchema/ste/values.xsd> <Agent> <Version>2.0.3</Version>
I have a XML File in the following format: <?xml version='1.0' encoding='UTF-8'?> <entry xmlns='http://www.w3.org/2005/Atom'
I have this xml file: <?xml version=1.0 encoding=UTF-8?> <Favorites> <favorite id=1> <title>My first favorite</title>
I have Data.xml: <?xml version=1.0 encoding=utf-8 ?> <data> <album> <slide title=Autum Leaves description=Leaves from
I have a xml file like this <?xml version=1.0 encoding=UTF-8?> <gallery > <gallerydata> <galleryname>
I have xml file like this <?xml version=1.0 encoding=UTF-8?> <specification xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:noNamespaceSchemaLocation=file://Desktop/normal.xsd> <university> <refstr>bdvl_te_skrm_stc</refstr>
I have xml file whose structure is defined with following xsd: <?xml version=1.0 encoding=utf-8?>

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.