Here’s the problem. I have an xml file in which there are multiple tags that, depending on who writes them, could end up being in any order. I need to create an xls file to style it whilst keeping the tags in their original order. Here is the xml:
<content>
<h>this is a header</h>
<p>this is a paragraph</p>
<link>www.google.com</link>
<h> another header!</h>
</content>
XSLT won’t re-order elements on its own, unless you tell it to do so. If you are matching elements, and replacing them with other elements, it will just process them in the order i finds them.
If you are looking to simply replace elements with HTML elements, you would simply write a matching template for each element, where you output the HTML element you need. For example, to replace an h element with an h1 element you could do this
The h1 element will be output in the position the h element was in the original document. Here is the full XSLT
When applied to your sample document, the following is output