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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:46:43+00:00 2026-06-01T11:46:43+00:00

I have the following XML structure: <Main> <Node1>Definite</Node1> <Node2>Definite</Node2> <Node3>Definite</Node3> <Node4>Definite</Node4> <Node5>Definite</Node5> <Node6>Definite</Node6> <A>Possible</A>

  • 0

I have the following XML structure:

<Main>
    <Node1>Definite</Node1>
    <Node2>Definite</Node2>
    <Node3>Definite</Node3>
    <Node4>Definite</Node4>
    <Node5>Definite</Node5>
    <Node6>Definite</Node6>
    <A>Possible</A>
    <B>Possible</B>
    <C>Possible</C>
    <D>Possible</D>    
    <E>Possible</E>
    <F>Possible</F>
    <G>Possible</G>
    <H>Possible</H>
    <I>Possible</I>
</Main>

The nodes named individual letters eg.<A> are nodes that may not exist within the XML structure while all other nodes are definite.

I need to insert the node <ZZZ> within the structure so that it always sits in the position shown below.

<Main>
    <Node1>Value</Node1>
    <Node2>Value</Node2>
    <Node3>Value</Node3>
    <Node4>Value</Node4>
    <Node5>Value</Node5>
    <Node6>Value</Node6>
    <A>Value</A>
    <B>Value</B>
    <C>Value</C>
    <D>Value</D>    
    <E>Value</E>
    <ZZZ>Value</ZZZ>
    <F>Value</F>
    <G>Value</G>
    <H>Value</H>
    <I>Value</I>
</Main>

So say node <E> and <C> and <H> didnt exist it would be:

<Main>
    <Node1>Value</Node1>
    <Node2>Value</Node2>
    <Node3>Value</Node3>
    <Node4>Value</Node4>
    <Node5>Value</Node5>
    <Node6>Value</Node6>
    <A>Value</A>
    <B>Value</B>
    <D>Value</D>    
    <ZZZ>Value</ZZZ>
    <F>Value</F>
    <G>Value</G>
    <I>Value</I>
</Main>

Hope this is explained clear enough 🙂

  • 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-01T11:46:44+00:00Added an answer on June 1, 2026 at 11:46 am

    well it is depending on which elements are requiered and which are optional! E.g. if you can say <F> is requierd you can insert the ZZZ-Element before the F-Element:

    <xsl:template match="node() | @*">
        <xsl:copy>
            <xsl:apply-templates select="@*"/>
            <xsl:apply-templates select="node()"/>
        </xsl:copy>
    </xsl:template>
    
    <xsl:template match="F">
        <ZZZ>Value</ZZZ>
        <xsl:copy>
            <xsl:apply-templates select="@*"/>
            <xsl:apply-templates select="node()"/>
        </xsl:copy>
    </xsl:template>
    

    if you can not say, there is a requiered element, you need to insert in a template for the Main-Element:

    <xsl:template match="Main">
        <xsl:copy>
            <xsl:apply-templates select="@*"/>
            <xsl:apply-templates select="Node1|Node2|Node3|Node4|Node5|Node6|A|B|C|D|E"/>
            <ZZZ>Value</ZZZ>
            <xsl:apply-templates select="F|G|H|I"/>
        </xsl:copy>
    </xsl:template>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following XML structure: <method constructor=true name=Main public=true> <parameterList/> <block> <call> <callAttrbute>
Say I have this following XML structure: <?xml version=1.0 encoding=UTF-8?> <main> <parent> <child1>some value</child1>
I have the following XML source structure: <turnovers> <turnover repid=1 amount=500 rate=0.1/> <turnover repid=5
I have the following simplified XML structure: <?xml version="1.0" encoding="UTF-8" ?> <INVOIC02> <IDOC BEGIN="1">
I have following object structure, deseralized from XML (WS): <ns2:Category> <ns2:CategoryId>800003</ns2:CategoryId> <ns2:CategoryName>Name1</ns2:CategoryName> <ns2:Categories> <ns2:Category>
I have a large xml file (approx. 10 MB) in following simple structure: <Errors>
Hi currently I have a nested XMl , having the following Structure : <?xml
I currently have the following directory structure for my code: src |-- main |
I have the following xml structure <clinic> <category> <employees> <medic> <medic_details> <medic_name /> <medic_address
I have the following XML structure... <Fields> <Field> <Company>My Company</Company> </Field> <Field> <Address2>Villa at

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.