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

  • SEARCH
  • Home
  • 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 1014945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:19:41+00:00 2026-05-16T10:19:41+00:00

I call a template like this: <xsl:call-template name=trip_form> <xsl:with-param name=header select=’Spara din resa’ />

  • 0

I call a template like this:

<xsl:call-template name="trip_form">
   <xsl:with-param name="header" select="'Spara din resa'" />
   <xsl:with-param name="size" select="'savetrip'" />
  </xsl:call-template>

The templte looks like this:

<xsl:template name="trip_form">
  <xsl:param name="type" />
  <xsl:param name="size" />
  <xsl:param name="header" />
  <xsl:if test="type = ''">
   <xsl:if test="/root/meta/url_params/has_car = 1">
    <xsl:with-param name="'type'" select="'driver'" />
   </xsl:if>
   <xsl:if test="/root/meta/url_params/has_car = 0">
    <xsl:variable name="'type'" select="'passenger'" />
   </xsl:if>
  </xsl:if>

etc…

When I specify the $type variable whilst calling the template, I want to use that value, but when I don’t I want to check the Url_params/has_car node and set the variable accordingly, how do I do this?

  • 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-16T10:19:41+00:00Added an answer on May 16, 2026 at 10:19 am

    You can’t update the value of a parameter or variable after it has been initially set. However, what you could do, is create a new variable, and set that according to whether the original parameter $type has been set or not.

    Try something like this. This creates a new variable, $newtype, which you can then use in your template. If $type is set, then $newtype will equal $type, otherwise it will look at the Url_params/has_car elements

    <xsl:template name="trip_form">
       <xsl:param name="type"/>
       <xsl:param name="size"/>
       <xsl:param name="header"/>
       <xsl:variable name="newtype">
          <xsl:choose>
             <!-- Check if type is defined -->
             <xsl:when test="$type = ''">
                <!-- Determine if a driver or passenger -->
                <xsl:choose>
                   <xsl:when test="/root/meta/url_params/has_car = 1">
                      <xsl:value-of select="'driver'"/>
                   </xsl:when>
                   <xsl:otherwise>
                      <xsl:value-of select="'passenger'"/>
                   </xsl:otherwise>
                </xsl:choose>
             </xsl:when>
             <xsl:otherwise>
                <!-- Use value of parameter -->
                <xsl:value-of select="$type"/>
             </xsl:otherwise>
          </xsl:choose>
       </xsl:variable>
    
       <!-- Use the new variable $newtype here -->
       <xsl:value-of select="$newtype"/>
    </xsl:template>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In following template call <xsl:call-template name=My_Class> <xsl:with-param name=className select=getClassName()/> <xsl:with-param name=baseClassName select=??????/> </xsl:call-template> i
<xsl:call-template name="myfield"> <xsl:with-param name=A/> <xsl:with-param name=B/> <xsl:with-param name=C/> <xsl:if test="not(starts-with(specialTest))"> <xsl:with-param name="TEST" select="'someFunction'"/> </xsl:when>
Thanks to this post I've come up with the following template:- <xsl:variable name=Doc> <xsl:call-template
I have a template: <xsl:template match=paragraph> ... </xsl:template> I call it: <xsl:apply-templates select=paragraph/> For
I call a template like this from my view: return render_to_response('mytemplate.html', context_instance=RequestContext(request)) I'm trying
Here's my template: <xsl:template name=rec> <xsl:for-each select=*> <div class={local-name()}> <xsl:for-each select=@*> <xsl:attribute name=data-{local-name()}> <xsl:value-of
I am working on call-template, where the source looks like this. Source: <Content> <first>
I am trying to call $this->getIsAnchor() from a category template file to show certain
Shouldn't I be able to call this CoffeeScript method from within an erb template?
I have XML like this: <assessment name=Assessment> <section name=Section1> <item name=Item1-1/> <item name=Item1-2/> <item

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.