I am trying to figure out how to sort the XML list of employees alphabetically by lastname using XSL. Right now it just displays the XML information in the same order as it
At a glance,
<xsl:sort select="Employee/Lastname" data-type="text" order="ascending"/>
<xsl:sort select="Employee/Firstname" data-type="text" order="ascending"/>
should be
<xsl:sort select="Lastname" data-type="text" order="ascending"/>
<xsl:sort select="Firstname" data-type="text" order="ascending"/>
for-each
sets the context node for the select
, so the expression is evaluated against the Employee nodes.
Also, text
and ascending
are defaults, so you could just write
<xsl:sort select="Lastname"/>
<xsl:sort select="Firstname"/>