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 6634069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:53:12+00:00 2026-05-25T22:53:12+00:00

I have only basic XSLT skills so apologies if this is either basic or

  • 0

I have only basic XSLT skills so apologies if this is either basic or impossible.

I have a paginator template which is used everywhere on the site I’m looking at. There’s a bug where one particular search needs to have a categoryId parameter appended to the href of the page links. I can’t alter the paginator stylesheet or else i would just add a param to it. What I’d like to do is apply the template as is then do a second transform based on its output. Is this possible? How do others normally go about extending library templates?

So far I’ve thought about doing a recursive copy of the output and applying a template to the hrefs as they are processed. The syntax for that escapes me somewhat, particularly as I’m not even sure it’s possible.


Edit – Between Dabbler’s answer and Michael Kay’s comment we got there. Here is my complete test.

 <xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:ext="http://exslt.org/common">
    <!-- note we require the extensions for this transform -->

    <!--We call the template to be extended here and store the result in a variable-->
    <xsl:variable name="output1">
            <xsl:call-template name="pass1"/>
    </xsl:variable>

    <!--The template to be extended-->
    <xsl:template name="pass1">
            <a href="url?param1=junk">foo</a>
    </xsl:template>

    <!--the second pass. we lock this down to a mode so we can control when it is applied-->
    <xsl:template match="a" mode="pass2">
            <xsl:variable name="href" select="concat(@href, '&amp;', 'catid', '=', 'stuff')"/>
            <a href="{$href}"><xsl:value-of select="."/></a>
    </xsl:template>

    <xsl:template match="/">
            <html><head></head><body>
                    <!--the node-set extension function turns the first pass back into a node set-->
                    <xsl:apply-templates select="ext:node-set($output1)" mode="pass2"/>
            </body></html>
    </xsl:template>

</xsl:stylesheet>
  • 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-25T22:53:13+00:00Added an answer on May 25, 2026 at 10:53 pm

    It’s possible in XSLT 2; you can store data in a variable and call apply-templates on that.

    Basic example:

    <xsl:variable name="MyVar">
       <xsl:element name="Elem"/> <!-- Or anything that creates some output -->
    </xsl:variable>
    <xsl:apply-templates select="$MyVar"/>
    

    And somewhere in your stylesheet have a template that matches Elem. You can also use a separate mode to keep a clear distinction between the two phases (building the variable and processing it), especially when both phases use templates that match the same nodes.

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

Sidebar

Related Questions

This is my first question on this site, and I only have a basic
I have only a basic understanding of Eclipse RCP. I am about to start
I have only a basic knowledge of css, is it possible to inherit a
I have very little programming knowledge; only a fair bit in Visual Basic. How
I have only recently started working with the MVC approach, so I suppose this
I have only this in my mxml source code: <?xml version=1.0 encoding=utf-8?> <mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml
I have only basic VBA experince and my prior Macro experence was primarily with
I only have very basic knowledge on Javascript and I want to be able
Quite new to xslt so forgive me if this is a basic question -
I have limited experience with JavaME in the past. I've worked in only basic

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.