Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7037101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:30:13+00:00 2026-05-28T01:30:13+00:00

I have this xslt : <xsl:param name=total_articles select=3 /> <xsl:param name=articles_per_page select=3 /> <xsl:apply-templates

  • 0

I have this xslt :

<xsl:param name="total_articles" select="3" />
<xsl:param name="articles_per_page" select="3" />

<xsl:apply-templates select="dagboek/entry[position &gt; $offset][position &lt; $articles_per_page+$offset]" >
   <xsl:with-param name="total_pages" tunnel="yes">
  <xsl:choose>
          <xsl:when test="$value="2005-09" and $page="1">8</xsl:when>
         <xsl:otherwise>floor(number($total_articles)-1) div $articles_per_page +1</xsl:otherwise>
  </xsl:choose>
  </xsl:with-param>
</xsl:apply-templates>

But now I get this error.

How can I calculate the outcome of the calculation and put it into the param total_pages.

Roelof

Edit 1: WHat I try to achieve is that if it’s not 2005-09 and page is not 1 then the totalpages is calculated out of total_articles and articles_per_page. The outcome has to be put into the param pages.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T01:30:14+00:00Added an answer on May 28, 2026 at 1:30 am
    <xsl:when test="$value="2005-09" and $page="1">8</xsl:when>
    

    This isn’t even well-formed XML document. The problem is with the nested quotes.

    Probably you meant:

    <xsl:when test="$value='2005-09' and $page='1' ">8</xsl:when>
    

    Another possible problem: Tunnel parameters are only available in XSLT 2.0. You seem to be using XSLT 1.0

    Update:

    The OP in a comment has modified/clarified his initial question:

    WHat I try to achieve is that if it’s not 2005-09 and page is not 1
    then the totalpages is calculated out of total_articles and
    articles_per_page. The outcome has to be put into the param pages.

    This can simply be expressed as:

       <xsl:with-param name="total_pages" select=
        "8*($value='2005-09' and $page='1')
        +
         (floor(number($total_articles)-1) div $articles_per_page +1)
        *
         not($value='2005-09' and $page='1')
        "/>
    

    Explanation:

    We are using the fact that in XPath 1.0 by definition number($someBoolean) is 1 if $someBoolean is true() and is 0 if $someBoolean is false().

    Therefore the pseudocode:

     if($vCond)
      then $vNum1
      else $vNum2
    

    can be expressed with a single XPath expression:

    $vNum1*$vCond + $vNum2*not($vCond )
    

    whenever a boolean is an argument to an arithmetic operator, it is automatically converted to a number.

    So, here’s what happens at run-time:

    1. Suppose $vCond is true(), therefore not($vCond) is false().

    2. Because $vCond and not($vCond) are arguments to the * operator, they are converted to numbers, respectively 1 and 0:

    …

    $vNum1*1 + $vNum2*0
    
    1. This is equivalent to:

    …

    $vNum1*1
    

    Note:

    The above equivalence rule can be further generalized to N mutually exclusive conditions $vCond1, $vCond2, …, $vCondN, and corresponding N values: $val1, $val2, …, $valN:

    $val1*$vCond1 + $val2*$vCond2 + ... + $valN*$vCondN
    

    is equal to $valK (k in {1,..., N}) exactly when $vCondK is true()

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following XSLT macro (in Umbraco) <xsl:param name=currentPage/> <xsl:template match=/> <xsl:apply-templates select=$currentPage/imageList/multi-url-picker
I have the following in my xslt file: <xsl:param name=predicate select=//Event /> <xsl:apply-templates select=$predicate
I have a: <xsl:param name=SomeFlag /> In my XSLT template, I want to do
I have the following XSLT Template: <xsl:template name=foo> <xsl:param name=arg1>0</xsl:param> <xsl:param name=arg2 /> <xsl:param
I have this XSLT 2.0: <xsl:stylesheet version=2.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform> <xsl:output indent=yes/> <xsl:strip-space elements=*/> <xsl:template match=node()|@*>
I have got an XSLT that looks like this: <xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform> <xsl:output method=xml
<xsl:stylesheet version=2.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform> <xsl:param name=blah>Content 1</xsl:param> <xsl:param name=blah2>Content 2</xsl:param> </xsl:stylesheet> If I have the
OK so I have an xslt issue that I cannot seem to solve. This
Have this query: SELECT HOUR( DATE ) AS hr, COUNT( * ) AS cnt
If I have an XML file that includes <param name=foo value=5000 >foo is a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.