fmweb77 Posted June 7, 2005 Posted June 7, 2005 Hi all, Can anyone help me? I want to know how can i do a list of found records with the link next/previous page i display the records with this code <xsl:for-each select="/fmrs:fmresultset/fmrs:resultset/fmrs:record"> <xsl:variable name="record" select="current()"/> <xsl:value-of disable-output-escaping="yes" select="$record/fmrs:field[@name = 'field1']/fmrs:data[1]"/> - <xsl:value-of disable-output-escaping="yes" select="$record/fmrs:field[@name = 'field2']/fmrs:data[1]"/> <br /> </xsl:for-each> is possible to have an xsl example? sorry for my bad english Thanks, Hide77
Martin Brändle Posted June 7, 2005 Posted June 7, 2005 You might do the following: (- Study an example that you can create with the FM XSLT Site Assistant.) - Look at page 137 (Appendix C) of the FMSA Custom Web Publishing Guide. In order that the examples described there work, you have to add the cdml2xsl_utilities.xsl file to your solution. You can get this file by converting a CDML solution with the CDML2XSLT conversion tool. I hope you have a CDML solution- but it seems so, because you refered to link-previous and link-next. I use record navigation blocks so often, that I placed the XSLT code for it into an own file (e.g. with an xsl:template for record navigation) and include the file with xsl:include in the results or details stylesheet. The record navigation is then called with a xsl:call-template .
fmweb77 Posted June 8, 2005 Author Posted June 8, 2005 thank you for the answer now i have another question how can i make a links pagination like? page1 - page2 - page3 perhaps is possible with javascript but i dont't know it very well thanks a lot!!! hide77
Martin Brändle Posted June 12, 2005 Posted June 12, 2005 Hmm, that's a design question. If you have just a low number of results, the page scheme can be done. However, if you have a high number (say 500 hits, and say 10 hits per page), shall your navigation look like this? page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 ? And what is if you get 5000 results? Or like this? 1 2 3 4 ... 50? And when one clicks 4 one gets maybe 1 ... 3 4 5 6 ... 50 ? What is if i want to go directly to page 30? Or like this? 1 2 3 4 5 6 7 8 9 10 next, if one clicks next one gets previous 11 12 13 14 15 16 17 18 19 20 next You see the problems of all those navigation schemes. You can do that with JavaScript. But then you rely on the user that he has turned it on in his browser. But it can also be done server-side with XSLT. However, XSLT does not have loops as we know from other programming languages. This has do to with the fact that XSLT is a functional language and therefore it does not allow for side effects. In a normal loop construct like this (pseudocode): maxpages = $foundcount / $current-max pageloop=1 repeat <a href="link($pageloop)">page $pageloop</a> pageloop = $pageloop + 1 until ($pageloop > $maxpages) The problem is that the variable pageloop is changed, which is not allowed in XSLT to avoid side effects. Instead one has to use recursion (pseudocode) maxpages = foundcount / currentmax call-template page with-param pageloop=1 with param maxpages=$maxpages /call-template template page param pageloop param maxpages if ($pageloop <= $maxpages) <a href="link($pageloop)">page $pageloop</a> call-template page with-param pageloop=$pageloop+1 with-param maxpages=$maxpages /call-template /if /template
Recommended Posts
This topic is 7104 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now