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[(_at_)type='MoveAssetSuccess']"/>
<xsl:for-each select="$nodes">
<xsl:sort select="./property[(_at_)name='sourceSPV']"
data-type="text" order="ascending"/>
<xsl:sort select="./property[(_at_)name='targetSPV']"
data-type="text" order="ascending"/>
<xsl:sort
select="concat(substring(property[(_at_)name='mfAccNo'],1,5),substring(proper
ty[(_at_)name='mfAccNo'],8,5),substring(property[(_at_)name='mfAccNo'],6,2))"/>
<xsl:variable name="p" select="position()"/>
How can I get the variable nodes to contain the sorted nodes?
Regards
Jan
-----Original Message-----
From: David Carlisle [mailto:davidc(_at_)nag(_dot_)co(_dot_)uk]
Sent: 29 April 2008 09:28
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] FW: Xslt that worked for fop0.20.2 no longer works at
later versions
Unfortunately I don't have time to do that now. Can you tell
me how I can compare the previous value in a for-each loop
In general that is not possible. Remember that there is no requirement
that the items are evaluated in any order, and in particular they may be
evaluated in parallel, that's the whole point of declarative side
effect free programming style as used by XSLT.
If you know that the for-each is iterating through all the child of
some common parent then the previous sibling will is
preceding-sibling::*[1]
but in general if the for-each is iterating over an arbitrary expression
then if you need to access the whole sequence then you may have to
access it something like
<xsl:variable name="nodes" select="some xpath"/>
<xsl:for-each select="$nodes">
<xsl:variable name="p" select="position()"/>
this node <xsl:apply-templates select="."/>
last node <xsl:apply-templates select="$nodes[$p - 1]"/>
David
________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs.
________________________________________________________________________
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
LEGAL NOTICE
The information contained in this e-mail and any attachments are private and
confidential.
This message is solely intended for a particular recipient, if you are not the
intended
recipient you are prohibited from storing, copying, disseminating or using the
information
in any way. If you received this e-mail in error please notify the sender
immediately.
E-mail transmission cannot be guaranteed to be secure or error-free as
information could
be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or
contain viruses.
The sender therefore does not accept liability for any errors, viruses or
omissions in the
contents of this message, which arise as a result of transmission. This e-mail
is not
intended to create legally binding commitments on behalf of Northern Rock plc,
nor do its
contents reflect the corporate views or policies of Northern Rock plc.
Northern Rock plc,
Registered Office Northern Rock House Gosforth Newcastle upon Tyne NE3 4PL.
Registered in England, number 3273685. Telephone No: 0191 2857191
Northern Rock plc is authorised and regulated by the Financial Services
Authority for
deposit-taking; advising on and arranging mortgages and general insurance; and
for
introducing life assurance and investments.
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--