I have been trying to change the order of the nodes based on structure.
Lets assume that we have an example xml
<?xml version="1.0" encoding="UTF-8"?>
<ParentNode>
<example>value</example>
<example>value</example>
<node>
<one>1</one>
<two>1</two>
<three>1</three>
<four>1</four>
</node>
<node>
<one>2</one>
<two>2</two>
<three>2</three>
<four>2</four>
</node>
</ParentNode>
This <node>
part is repeating for other values as well, this is the simplified version of the whole structure.
What i want is: I want to change the order of the <node>
with values 2 , with <node>
with values 1
<?xml version="1.0" encoding="UTF-8"?>
<ParentNode>
<example>value</example>
<example>value</example>
<node>
<one>2</one>
<two>2</two>
<three>2</three>
<four>2</four>
</node>
<node>
<one>1</one>
<two>1</two>
<three>1</three>
<four>1</four>
</node>
</ParentNode>
Lets assume that, <three>
is a key value for us to re-order the nodes, So i would like to say <xsl:when test="value=2">
put whole before the first one.
How can i write it in XSLT 2.0 ?
EDIT: I found the solution by changing the variables inside the templates, So What i did is, putting the value "2" nodes into "1" and, This is a manual solution, but at the end, it works. Thank you for the ideas