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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T14:18:58+00:00 2026-05-19T14:18:58+00:00

I have an xML, which has lots of elements, some looks like that: <Images>

  • 0

I have an xML, which has lots of elements, some looks like that:

<Images>
−
<Image>
<FileName>L_03AB1B13144B416A8E779E0010D27156_iList.jpg</FileName>
<SequenceNumber>8</SequenceNumber>
<IsDefault>False</IsDefault>
</Image>
−
<Image>
<FileName>L_36438628E6E343919D77A3D27877A650_iList.jpg</FileName>
<SequenceNumber>9</SequenceNumber>
<IsDefault>False</IsDefault>
</Image>
−
<Image>
<FileName>L_3E0BFE975FA04A46848C3B3D983C4DE7_iList.jpg</FileName>
<SequenceNumber>10</SequenceNumber>
<IsDefault>False</IsDefault>
</Image>
−
<Image>
<FileName>L_DAD3FA64670E40F5BD0B48343216BF76_iList.jpg</FileName>
<SequenceNumber>11</SequenceNumber>
<IsDefault>False</IsDefault>
</Image>
−
<Image>
<FileName>L_2522D5E120574582A926032E1DF4733F_iList.jpg</FileName>
<SequenceNumber>12</SequenceNumber>
<IsDefault>False</IsDefault>
</Image>
</Images>

I would like to loop on every filename, which is easy with for-each, but I want to count it,and produce something like that (XML):

<pic_1>L_03AB1B13144B416A8E779E0010D27156_iList.jpg</pic_1>

<pic_2>L_36438628E6E343919D77A3D27877A650_iList.jpg</pic_2>

etc… (take a look at the elements, 1,2…)
how do I do 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-05-19T14:18:59+00:00Added an answer on May 19, 2026 at 2:18 pm

    It is generally a bad idea to name equal elements differently. Instead of <pic_1>, <pic_2> do <pic num="1">, <pic num="2">.

    This makes your life a lot easier when working with the XML document later. XPath queries, XSLT transformations, DOM operations – anything will be much simpler and much more consistent.

    <xsl:template match="Image">
      <pic num="{position()}">
        <xsl:value-of select="FileName" />
      </pic>
    </xsl:template>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an configuration xml file which has some values like <config> <map>100,1,200,1</map> <image>abc.bmp</image>
I have an XML file which has many section like the one below: <Operations>
I have a very large XML file which has like 40000 data, and when
I have XML tag that has the content which is HTML document. <xml-tag> <!--
I have an XML file that has a number of nodes, each of which
I have some XML which I am testing, which has set as one of
I have an XML file which has a simple nodes like: <question lang='en'>Do you
I have an XML file which has some values in child Element aswell in
I have a large XML file (180 megs or so) that has lots of
I have a xml document which has a node that contains a proper name

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.