xslt sort by two columns, where one is only partial
I have many nodes I wish to sort. - They all have a create date. - Some have an edit date to.
(update) Since no ansers I will add an example of en xml document to search
<page>
<createdate>2010-01-05</createdate>
<editdate>2010-01-07</editdate>
</page>
<page>
<createdate>2010-01-06</createdate>
<editdate></editdate> (do not know is this row is there at all)
</page>
<page>
<createdate>2010-01-07</createdate>
<editdate>2010-01-10</editdate>
</page>
I would like a sort that order by开发者_运维技巧 "createdate and use "editdate" if it exist.
Can this be done in XSLT 1.0?
BR. Anders
UPDATE: SOLVED by solution given below
How about using a concatenation of editdate and createdate as the selection for the xsl:sort? like
<xsl:for-each select="page">
<xsl:sort select="concat(editdate, createdate)"/>
<!-- do stuff -->
</xsl:for-each>
精彩评论