[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: FW: Xslt that worked for fop0.20.2 no longer works

Subject: Re: 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
Re:  FW: Xslt that worked for fop0.20.2 no longer works
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.