grantdb Posted September 16, 2010 Share Posted September 16, 2010 Is something like this possibleA canned sort that is used lots of times<xsl:template name="CannedSorts"> <xsl:sort select="ACTIVE"/> <xsl:sort select="not(boolean(AUTHOR1SURNAME/text()))"/> <xsl:sort select="AUTHOR1SURNAME"/> <xsl:sort select="not(boolean(SERIESTITLE/text()))"/> <xsl:sort select="SERIESTITLE" order="ascending" data-type="text"/> <xsl:sort select="SERIES_NUMBER" order="ascending"/> <xsl:sort select="*[name()=$VARsortbyMatrix]" order="ascending"/></xsl:template> Call like below<xsl:for-each select="/forrendering/RESULTS/DOCUMENTS/DOCUMENT"> <xsl:call-template name="CannedSorts"> No other stuff</xsl:call-template> I get an error saying sort cannot be used here.Any help will be appreciatedThanksGrant Link to comment Share on other sites More sharing options...
Martin Honnen Posted September 16, 2010 Share Posted September 16, 2010 Well the documentation of xsl: sort in XSLT 1.0 is here: http://www.w3.org/TR/xslt#sorting, it clearly names the two elements you can put xsl: sort into, namely xsl: apply-templates and xsl: for-each. XSLT 2.0 adds xsl: for-each-group to that.You seem to want to construct new XSLT code at run-time, that is not how it works, unless you use two transformation steps where the first step creates an XSLT stylesheet itself as its result and the second step applies that stylesheet. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.