I need an XSL rule to move an XML sub-element to print before the preceding-siblingâs last sub-element (<tools> or it could be <parts>). My if statement is:
Quote:
IF (/work/prelim/tools OR /work/prelim/parts) AND /work/main/planning exist in the XML,
THEN
MOVE /work/main/planning to print BEFORE (/work/prelim/tools OR /work/prelim/parts)
OTHERWISE just <apply-templates />.
|
I've tried several things, but I just can't get it to print before <tools> (or in some files, it's <parts>).
XML is as follows:
Code:
<work>
<prelim>
<code>ABC</code>
<source>DEF</source>
<tools>Includes codes for a table</tools>
</prelim>
<main>
<planning>Text for Planning</planning>
<p>blah blah blah</p>
</main>
</work>
I want my output to be as follows (if the above condition exists):
Code:
<work>
<prelim>
<code>ABC</code>
<source>DEF</source>
<planning>Text for Planning</planning>
<tools>Includes codes for a table</tools>
</prelim>
<main>
<p>blah blah blah</p>
</main>
</work>
Can anyone help me on how to achieve this?
Thanks in advance!!
lkd