If I call an xslt template like so:
<xsl:template match="hist:Steps">
<dgml:Links>
<xsl:apply-templates select="hist:Step">
<xsl:sort data-type="text" select="hist:End" order="ascending"/>
</xsl:apply-templates>
</dgml:Links>
</xsl:template>
Will the following-sibling
axis in the template below interrogate the document order or the sorted order?
<xsl:template match="hist:Step">
<xsl:if test="following-sibling::hist:Step">
<dgml:Link>
<xsl:attribute name="Source">
<xsl:value-of select="hist:Workstation"/>
</xsl:attribute>
<xsl:attribute name="Target">
<xsl:value-of select="following-sibling::hist:Step/hist:Workstation"/>
</xsl:attribute>
</dgml:Link>
</xsl:if>
</xsl:template>
XPath axes reflect the relationships of a node in the input tree (or a temporary tree, if the node is in a temporary tree). They have nothing to do with the order of processing (the following sibling of a node is not necessarily even one of the nodes you selected for processing).
This differs from position() - it's a common mistake to think that position() tells you something about the position of the node within its tree, but it's actually the position of the node within the list of nodes selected for processing.
XSLT takes an input tree and transforms it into a result tree, your path expressions always operate on the input tree so any siblings you are looking for are navigated to in the input tree. With XSLT 2.0 (or with XSLT 1.0 and an extension function like exsl:node-set http://www.exslt.org/exsl/index.html) you can create variables with temporary trees you can then navigate in e.g.
would then process a temporary node-set of Step elements which have been sorted.
With XSLT 2.0 you don't need the exsl:node-set call.