xsl-list
[Top] [All Lists]

Re: [xsl] FW: Xslt that worked for fop0.20.2 no longer works at later versions

2008-04-29 06:46:18
On Tue, Apr 29 2008 11:25:53 +0100, 
Jan(_dot_)Hesselberth(_at_)northernrock(_dot_)co(_dot_)uk 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[(_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?

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[(_at_)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[(_at_)type='MoveAssetSuccess']/descendant::propert
y[(_at_)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(_dot_)Graham(_at_)MenteithConsulting(_dot_)com
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

--~------------------------------------------------------------------
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>
--~--