In my xslt there is one condition with TAG called NO (generates some number everytime) <xsl:element name="SCHEDULE_ELEMENT"> <xsl:variable name="preceding_element" select="preceding-sibling::SCHEDULE_ELEMENT"/> <xsl:element name="NO"> <xsl:value-of select="NO"/> </xsl:element>
But the number in xml comes very random like 1 1 3 1 5 or anything now i need to generate a list of numbers,in creasing order from 1 to any (may be using for loop) the number of times this condition met. It can be any number of times.
and if it gets stored anywhere (in kind of buffer or so) the time NO tag ends it should go back to 0 or 1, so that for next xml, it won't create anything starting from, except 0 or 1.
Well, I read your explanation four times and I still couldn't quite understand it. And even XSLT code is easier to read if it's indented, so your code wasn't all that helpful. (You might want to edit your post and put the code into the CODE tags, then indent it, for other readers.)
But what I think I got was this: you want to execute a template with values of I running from zero to N. Or 1 to N, doesn't really matter. You had some stuff about NO which I didn't quite understand because it didn't refer to anything in your example, but it looked like you were trying to change the value of a variable. You can't do that in XSLT. And you can't change anything in the input document either, if that was what you meant.
You need a recursive template, I think. This technique is well covered in books about XSLT, but it isn't covered by so-called tutorial sites on the web that just rehash what the XSLT elements do. Like this (I didn't do the XSLT verboseness though):
Then to get it started you just do template(1, MAX) and the recursive processing does the loop.
Well you understood true. I have NO tag with some different values (its a unique number always coming from some input xml file) but the xml file was having recursive structure, so after making it flat, the values of No tag are not quite in sequence. The values are may be like 1,2, 1,2,3, 1,5,6,7, 8,9,1,2,3 or so on. I just want a sequence to be followed, for that purpose i was trying to generate some loop with standard numbers. like 1,2,3,4,5,6,7,8,9 & so on. I have one more option, from input file, i can ignore getting the NO(Number) tag values and put my own.If it is possible. Please suggest me.
Well, now I'm confused. You say "I have NO tag with some different values" but then you posted some code which is trying to generate NO elements. So which is it? The NO elements are in the input file or you want to generate them into the output file?
And I'm also confused about this NO element. Or these NO elements. Is there only one, and it contains a text element that looks like "1,2,3"? Or are there many, and each contains only a single number?
And please indent your code. Use the CODE tags to do that. There's a convenient button you can use to do that.
Not really. I still can't figure out whether you "get" that as part of your input document or whether you "get" it as a result of the transformation. I asked that already but your answer didn't answer the question.
In normal words the input xml does have NO tag with values in recursive order. So the structure, which shows the contents will be something like
Here i have shown only 1 level of recursion. now after making this structure flat we can expect the output to be shown in output xml as
But what i really need to modify is
and so on.
DO you think it is really possible. Or by using any loop which can ignore real value of NO tag initially and then we generate our own values and insert them in output xml. Am i clear now. YOu can ask me if any clarification required.
How do they get the deer to cross at the signs? Or to read this tiny ad?