Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • pnr 131 posts 226 karma points
    Mar 29, 2009 @ 10:00
    pnr
    0

    Paging in XSLT

    Hov is it posible to make paging in XSLT?
    I have a large record set that i would like to show on more than one page

  • Comment author was deleted

    Mar 29, 2009 @ 10:14

    Hi,

    Check out this example: http://www.nibble.be/?p=11

  • pnr 131 posts 226 karma points
    Mar 31, 2009 @ 12:23
    pnr
    0

    Thanks very much!

  • Dan Diplo 1554 posts 6205 karma points MVP 6x c-trib
    Mar 31, 2009 @ 14:46
    Dan Diplo
    0

    You may also find this example I created helpful (adapted from Tim's):

    http://forum.umbraco.org/yafpostst7794Flexible-XSLT-Paging-and-Sorting-Example.aspx

  • Kim Andersen 1447 posts 2196 karma points MVP
    Sep 18, 2009 @ 11:50
    Kim Andersen
    0

    I just tried the pagination from Tim, and most of it works. But is it possible to make it start from page 1 instead of page 0?

    I tried to change the value in $pageNumber from 0 to 1, but that didn't do the trick. Can anyone help me with a smart solution to this?

     

    Thanks

    -Kim Andersen

  • Kim Andersen 1447 posts 2196 karma points MVP
    Sep 18, 2009 @ 19:58
    Kim Andersen
    0

    Nevermind guys. I got some very nice help from Jan Skovgaard. Thanks again Jan :)

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Sep 21, 2009 @ 09:07
    Jan Skovgaard
    0

    You are welcome Kim :)

  • Dmitrij Jazel 86 posts 179 karma points
    Nov 19, 2011 @ 17:28
    Dmitrij Jazel
    0

    Hello everyone :)

    I am trying to achieve the same:
    http://www.nibble.be/?p=11
    But it seams to be not working, not only because of the markup, but also because it is quite old now July 27, 2009.
    There are almost no examples since, the most new one I found was 
    http://our.umbraco.org/projects/developer-tools/paging-xslt
    and http://our.umbraco.org/projects/developer-tools/paging-xslt/everything/10636-Any-updates-for-Umbraco-45

    but that is more or less it...
    I also could use Gridview in user controll, but that is not the goal. I am sure there can be a wayout with xslt.

    could use some assistance :)

    many thanks in advance.

    Dmitrij

     

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Nov 19, 2011 @ 23:06
    Chriztian Steinmeier
    0

    Hi Dmitrij,

    I just pushed my "_PaginationHelper.xslt" to GitHub - might be what you need :-)

    /Chriztian

  • Dmitrij Jazel 86 posts 179 karma points
    Nov 20, 2011 @ 01:36
    Dmitrij Jazel
    0

    Hi Chriztian,

    Thanks for that :) really awesome you answered so fast :)
    To make it even better, just wanted to clear this one a bit.

    Lets say, now I just have a macro called "listSubpages" that uses the xslt file with the same name. It simply prints out the list of subnodes
    As I understood, 1) I include

    <xsl:include href="_PaginationHelper.xslt" />

    in my simple "listSubpages.xslt" file.

    Than I just create "_PaginationHelper.xslt" and save it in XSLT folder with the rest of them.
    2) Than (in the same "listSubpages.xslt" file) add a new template

    <xsl:template match="Textpage">
        <li>
            <href="{umbraco.library:NiceUrl(@id)}">
                <img src="{pageImageThumbnail}" width="100" height="80" alt="{@nodeName}" />
            </a>
        </li>
    </xsl:template>

    where "Textpage" is a doctype Alias of the actual subpage I am using as childnode.

    Now the tricky part:
    You say: "Call the PaginateSelection template where you want the paged result to appear." and (as I understood) that is right instead of initial autogenerated match="/" template in the same "listSubPages.xslt" file.

    <xsl:template match="/">
        <xsl:call-template name="PaginateSelection">
            <xsl:with-param name="selection" select="$currentPage/Textpage">
        </xsl:call-template>
    </xsl:template>

    As a result, I am getting umbraco xslt editors error, can't save cause there might be a mistake, not sure where and why. This is how my listSubPages.xslt looks like:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet 
      version="1.0" 
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
      xmlns:msxml="urn:schemas-microsoft-com:xslt" 
      xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" 
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">

    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>
    <xsl:include href="_PaginationHelper.xslt" />

    <xsl:template match="/">
        <xsl:call-template name="PaginateSelection">
            <xsl:with-param name="selection" select="$currentPage/Textpage">
        </xsl:call-template>
    </xsl:template>
        
    <xsl:template match="subPage">
        <li>
            <href="{umbraco.library:NiceUrl(@id)}">
                <img src="{pageImageThumbnail}" width="100" height="80" alt="{@nodeName}" />
            </a>
        </li>
    </xsl:template>

    </xsl:stylesheet>

    And theoretically it should work as you say, strange why I can't call a template from another file if it is included.
    Not sure what am I doing wrong. Please correct me if I am wrong here :)

    Much appreciated!

    Dmitrij

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Nov 20, 2011 @ 10:31
    Chriztian Steinmeier
    0

    Hi Dmitrij,

    Seems I left out an important part of the equation:

    When using include files, you need to check the "Skip errors" (or similarly labeled) checkbox when saving, because that process ends up looking for the include file(s) in the wrong place, which of course throws errors all over the place. (I *always* edit my XSLT files outside of Umbraco, so I guess that's why I never thought of mentioning that...)

    Also, you will probably run into issues with changes in the included file(s) not taking effect, which is caused by .NET compiling the resulting stylesheet - all you need to do to fix that is install the XSLTouch package and forget about it. Really, it's that cool :-)

    Hop this gets you closer to worry-free paged output with XSLT...

    /Chriztian

  • Dmitrij Jazel 86 posts 179 karma points
    Nov 20, 2011 @ 14:38
    Dmitrij Jazel
    0

    Hi Chriztian,

    I also edit XSLT's in VS, if there is any way out, but just to make sure that XSLT will actually parse, I prefer to edit it in Umbraco :) to make sure it fits ^^.

    I wish I could tell you good news, but still something is a miss.

    + Install XSLTouch (check)
    + Just replase initial match="/" template with one you provided and save via VS. (check)

    Than hoping to see the list, but instead am getting xslt "Error reading XSLT file: \xslt\ListChildren.xslt" error text.

    Not sure what can be wrong again. And yea, funny notice, After I installed XSLTouch my Localhost started to hang, and crashed several times, had to restart it. Strange, even after I set up a little site (for you to check if possible and make things easier), after XSLTouch installation the site just crashed. :D

    Any idea what is going on? :)

    Many many thanks in advance!

    Dmitrij

    P.S. http://pimpmyxslt.com/ is Awesome!!! Great job! :)

  • sun 403 posts 395 karma points
    Nov 20, 2011 @ 14:48
    sun
    0

    install XSLTsearch and view it, you can learn a lot about xslt.

  • Dmitrij Jazel 86 posts 179 karma points
    Nov 20, 2011 @ 15:01
    Dmitrij Jazel
    0

    Hi sun,

    XSLTsearch? yes, I know it, it has paging function, and is really good search macro.

    I am sure that you could learn alot from any good XSLT example, I know that XSLT file, and it is XXXXL BIG :D. And I really like Chriztian's solution. I think that is the right way to do it.

    Speaking of "forking enormous XSLT file" just to make a list page-able. I am sure there must be an easier way out, since allot of people should have encountered the same problem many times before.

    Still thanks for advice ;)

    Dmitrij

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Nov 20, 2011 @ 16:31
    Chriztian Steinmeier
    0

    Hi Dmitrij,

    Glad to see you're hangin in there - and thanks for plugging the site :-)

    Good thing about the XSLT Visualizer in Umbraco is that it gives you the error message(s) from .NET, so have you looked at that?

    You should also try adding ?umbDebugShowTrace=True to the URL of the page throwing errors - that will also give you some sort of error message.

    Final thought: There was a typo in the first version on GitHub, but I fixed that really quick, so didn't figure you'd have downloaded the file, but that could be the source of error too... if the error message has to do with the namespace prefix "umbraco.library" not defined or similiar, check that you've got the latest version from the GitHubs...

    I'll stick with you 'till this works so let me know how it goes.

    PS: Regarding the problems with XSLTouch - I've never had any issues like that, but Pete (the developer) will definitely like to hear about it; so if you've got any easy steps to recreate the problem, do send them to him (or open a thread on the project's forum).

    /Chriztian

  • Dmitrij Jazel 86 posts 179 karma points
    Nov 21, 2011 @ 19:31
    Dmitrij Jazel
    1

    Hi Chriztian,

    Guess what, good news!!! :)

    I managed to make list pagable (as simple as that) so many thanks for your https://github.com/greystate/Greystate-XSLT-Helpers link!

    1 small correction made the trick :)))

    in your Github post, part 3) where you have to replace match="/" template part,

    There was a closing tag missing in line 3, the final result is supposed to look like this:

      <xsl:template match="/">
        <xsl:call-template name="PaginateSelection">
          <xsl:with-param name="selection" select="$currentPage/SubPage" />
        xsl:call-template>
      xsl:template>

    And so now it works like a charm, a VERY nice and elegant solution. That is exactly what I was looking for :)

    Thanks again!

    Dmitrij

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Nov 21, 2011 @ 21:02
    Chriztian Steinmeier
    0

    Oh my - Good Heavens!

    Special commit for you!

    Glad you like this way of tackling a problem like this - I kept tweaking the guts out of it to make it possible to "just add pagination" :-)

    /Chriztian

     

     

     

Please Sign in or register to post replies

Write your reply to:

Draft