Splitting data using xslt

here my case
I have structure like this
<header>
<F1>
<F2>
<F3>
<item1>
<F1>
<F2>
<F3>
<item2>
<F1>
<F2>
<F3>
<item3>
<F1>
<F2>
<F3>
<item4>
.
.
.
.
<item n>


the target i want to create is in the first file
<header>
<F1>
<F2>
<F3>
<item1>
<F1>
<F2>
<F3>
<item2>
<F1>
<F2>
<F3>

in second file it goes like that
<header>
<F1>
<F2>
<F3>
<item3>
<F1>
<F2>
<F3>
<item4>
<F1>
<F2>
<F3>

here the problem is the target xsd has structure defined as (1..unbounded)
but i want to map only 2 and then remaining in next structure

how to code this...pls help

Recommended Answers

All 3 Replies

Couple things. The XML snippet your posted is confusing, it's not even a well formed document. So I don't know what the input document looks like. Create a real, stripped down sample of both your input and the output that's desired.

Also, USE CODEBOXES! That's what they're for people.

Lastly, you don't clearly state what you want. Do you want the output to be a maximum of 2 files? With the first 2 items being in one file and the entire rest of the document in another? Or do you want a new file created for every 2 items?

for example
when we get file with 1 header(node) and 55 items(node), in the target side we have to create 6 header(node) and 10 items(node) maximum under this....so in this case we have 6 header under this 10 items (node)
but last 6th header(node) has got only 5 items(node) in it.

similarly when we get 1 header(node) and 78 items(node), in the target side we have to create 8 header(node) and 10 items(node) maximum under this....so in this case we have 8 header under this 10 items (node)
but last 8th header(node) has got only 8 items(node) in it.


we don't know the maximum number of items(node) in the incoming file, it may have 55 items, 200 items ...any thing.....so i need to split dynamically in the runtime and need to create the target node depends on the input


could anyone help in this ...pls urgent....if u need more clarification just let me know

Once again, now you're mixing requirements. In the first post you say you want multiple output files, but now you're saying you only want grouped node sets. I partially understand what you're trying to explain, but you're contradicting yourself. The first you only want to group by pairs and split files, now you want to group by 10 and have them in 1 file? 2 files?

Create a real, stripped down sample of both your input and the output that's desired.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.