Subject: Re: [xsl] FW: Xslt that worked for fop0.20.2 no longer works at later versions From: Tony Graham <Tony.Graham@xxxxxxxxxxxxxxxxxxxxxx> Date: Tue, 29 Apr 2008 14:45:59 +0100 |
On Tue, Apr 29 2008 11:25:53 +0100, Jan.Hesselberth@xxxxxxxxxxxxxxxxxx wrote: > I thought this solved the problem but I have found when using xsl:sort, > the positions reference the unsorted nodes. > > I have > <xsl:variable name="nodes" > select="//property[@type='MoveAssetSuccess']"/> > <xsl:for-each select="$nodes"> > <xsl:sort select="./property[@name='sourceSPV']" > data-type="text" order="ascending"/> > <xsl:sort select="./property[@name='targetSPV']" > data-type="text" order="ascending"/> > <xsl:sort > select="concat(substring(property[@name='mfAccNo'],1,5),substring(proper > ty[@name='mfAccNo'],8,5),substring(property[@name='mfAccNo'],6,2))"/> > <xsl:variable name="p" select="position()"/> > > How can I get the variable nodes to contain the sorted nodes? Looking at the code that you posted the other day, it seems that you need the sorted position to be able to work out whether or not to generate some output. E.g.: ------------------------------------------------------------ <xsl:if test="ancestor::property[@type='MoveAssetSuccess']/descendant::property[ @name='mfAccNo'] != $lastacc"> <fo:block space-before.optimum="5pt" space-after.optimum="5pt" font-size="10pt" text-align="left"> <xsl:apply-templates select="ancestor::property[@type='MoveAssetSuccess']/descendant::propert y[@name='mfAccNo']"/> </fo:block> </xsl:if> ------------------------------------------------------------ If that is the case, then your problem could be recast as needing to group certain nodes and only needing to generate some output at the start of the group. There were numerous folk remedies for grouping developed for XSLT 1.0 that people have been happy to forget now that there's XSLT 2.0. Using XSLT 2.0 is generally better, unless it's not an option. Resources for XSLT 1.0 grouping include: - EXSLT set functions [1] - Jeni Tennison's Grouping pages [2] - Dave Pawson's XSLT FAQ [3] Regards, Tony Graham Tony.Graham@xxxxxxxxxxxxxxxxxxxxxx Director W3C XSL FO SG Invited Expert Menteith Consulting Ltd XML, XSL and XSLT consulting, programming and training Registered Office: 13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland Registered in Ireland - No. 428599 http://www.menteithconsulting.com -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- xmlroff XSL Formatter http://xmlroff.org xslide Emacs mode http://www.menteith.com/wiki/xslide Unicode: A Primer urn:isbn:0-7645-4625-2 [1] http://exslt.org/set/functions/distinct/index.html [2] http://www.jenitennison.com/xslt/grouping/index.xml [3] http://www.dpawson.co.uk/xsl/sect2/N4486.html
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] FW: Xslt that worked for , David Carlisle | Thread | RE: [xsl] FW: Xslt that worked for , Michael Kay |
[xsl] [XSL] Grouping and Sum proble, Mike Finch [Wasabeat | Date | RE: [xsl] String ends with ?, ! or , Pankaj Chaturvedi |
Month |