The below code works fine:
Code:
<xsl:variable name="Months">
<i ref="Jan" val="01">01</i>
<i ref="Feb" val="02">02</i>
...
</xsl:variable>
<xsl:sort order="descending" select="
concat(
substring(@created, 13, 4 ),
document('')/*/xsl:variable[@name='Months']/i[@ref=substring(current()/@created, 9, 3 )]/@val,
substring(@created, 6, 2 ),
substring(@created, 18, 8 )
) ) />
But when I surround the sort selection with a conditional as I am certain is allowed, at the sort instruction, the processor gives me an "F Error in expression" and "E error in expression" and I don't understand why.
Code:
...
<xsl:param name="sortBy" select="created" as="xs:string"/>
<xsl:sort order="descending" select="
if($sortBy='created') then (
concat(
substring(@created, 13, 4 ),
document('')/*/xsl:variable[@name='Months']/i[@ref=substring(current()/@created, 9, 3 )]/@val,
substring(@created, 6, 2 ),
substring(@created, 18, 8 )
) )
else
( concat(
substring(@modified, 13, 4 ),
document('')/*/xsl:variable[@name='Months']/i[@ref=substring(current()/@modified, 9, 3 )]/@val,
substring(@modified, 6, 2 ),
substring(@modified, 18, 8 )
) )
" />
Any help would be greatly appreciated. Thanks!
Jeff
Headers:
Code:
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xdt="http://www.w3.org/2005/04/xpath-datatypes"
version="2.0">
--
Check out my blog,
http://www.tipninja.com, the where I share tips from optimizing your PC use, to cooking and food storage and household organization to personal happiness.