Copied to clipboard

Flag this post as spam?

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


  • kannandesikan 48 posts 68 karma points
    Nov 09, 2012 @ 18:54
    kannandesikan
    0

    xslt when usage

    Hi,

     

    pls explain me below, how it works , what value it retrive

    how we declare variable in xslt?

    pls explain me below code

      <xsl:when test="number(umbraco.library:RequestQueryString('page')) &lt;=1
                or string(umbraco.library:RequestQueryString('page')) = ''
                or string(number(umbraco.library:RequestQueryString('page'))) = 'NaN'">
                  <xsl:value-of select="1"/>
            </xsl:when>


  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Nov 09, 2012 @ 19:24
    Jan Skovgaard
    0

    Hi Kannadesikan

    If think it would be great if you could keep your XSLT related questions in the same post so that all the information is possible to find in the same post and others can benefit from reading the entire post instead of finding snippets when they search - I've provided an answer to your initial questio in here: http://our.umbraco.org/forum/developers/xslt/36014-xslt-doubts?p=0#comment130584

    The above example looks like a snippet from a paging snippet, where the value of the "page" querystring is being tested. If the qyerstring has a value of 1, is empty or is not a number the value "1" is written out. The querystring is what is added to the "main" url so if you have a url like this: http://mysite.com?page=1 - 1 is returned. If it's http://mysite.com?page=2 - 2 is returned and so on.

    You can declare a variable like <xsl:variable name="myvariable" select="umbraco.library:RequestQueryString('page')" /> or you can make the variable contain a conditional value by writing this

    <xsl:variable name="myvariable">
    <xsl:choose>
        <xsl:when test="umbraco.library:RequestQueryString('page') = ''">1</xsl:when>
        <xsl:when test="umbraco.library:RequestQueryString('page') = ''ABC">1</xsl:when>
    </xsl:choose>
    </xsl:variable>

    The second example is not the best but it should be enough to get the ghist of it I believe :)

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft