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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:50:24+00:00 2026-06-04T05:50:24+00:00

for performance testing purposes I want to take a small XML file and create

  • 0

for performance testing purposes I want to take a small XML file and create a bigger one from it – using XSLT. Here I plan to take each entity (Campaign node in the example below) in the original XML and copy it n times, just changing its ID.
The only way I can think of to realize this, is a xsl:for-each select “1 to n”. But when I do this I do not seem to be able to access the entity node anymore (xsl:for-each select=”campaigns/campaign” does not work in my case). I am getting a processor error: “cannot be used here: the context item is an atomic value”.
It seems that by using the “1 to n” loop, I am loosing the access to my actual entity. Is there any XPath expression that gets me access back or does anyone have a completely different idea how to realize this?

Here is what I do:

Original XML

<campaigns>    
<campaign id="1" name="test">
<campaign id="2" name="another name">
</cmpaigns>

XSLT I try to use

<xsl:template match="/">
 <xsl:element name="campaigns">
 <xsl:for-each select="1 to 10">
  <xsl:for-each select="campaigns/campaign">
   <xsl:element name="campaign">
   <xsl:copy-of select="@*[local-name() != 'id']" />
   <xsl:attribute name="id"><xsl:value-of select="@id" /></xsl:attribute>
   </xsl:element>
  </xsl:for-each>
 </xsl:for-each>
 </xsl:element>
</xsl:template>
  • 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-04T05:50:25+00:00Added an answer on June 4, 2026 at 5:50 am

    Define a variable as the first thing in the match, like so:

    <xsl:variable name="foo" select="."/>
    

    This defines a variable $foo of type nodeset. Then access it like this

    <xsl:for-each select="$foo/campaigns/campaign">
    ...
    </xsl:for-each>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

any one using selenium scripts with jmeter for performance testing
For performance testing, I would like to capture some traffic from a production server
I wrote simple load testing tool for testing performance of Java modules. One problem
When performance testing a web site using the Load Web Test of Visual Studio
I recently did some performance testing and analysis of an ASP.NET application using out-of-process
can any one suggest me best open source Performance testing and Load Testing tools
I am just doing some performance testing with clojure using pmap and I would
I've developed a WCF service, and I'm testing it for performance using Visual Studio
I am doing some performance testing on a SQL sproc and just want to
I'm attempting to write a performance testing function that can take any function, run

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.