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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T00:10:32+00:00 2026-05-11T00:10:32+00:00

I know that XSLT does not work in procedural terms, but unfortunately I have

  • 0

I know that XSLT does not work in procedural terms, but unfortunately I have been doing procedural languages for too long. Can anyone help me out by explaining in simple terms how things like apply-templates works and help a thicko like me to understand it.

  • 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. 2026-05-11T00:10:33+00:00Added an answer on May 11, 2026 at 12:10 am

    What makes you think that procedural terms do not apply here? It’s just that the calling convention is somewhat more implicit than you would traditionally expect it, because there is an invisible context involved. Everything apply-templates does could be expressed in procedural terms.

    Basically, apply-templates is nothing more than a for-each loop. Starting from where where you currently are in the document (the context, think ‘this‘), it iterates over the child nodes.

    For each child, the processor selects the matching xsl:template with the highest priority (based on their respective match and priority attributes), sets the context to the child at hand and runs this template (think ‘function‘). After the template returns, the context snaps back and it’s the next child’s turn.

    Even when things become recursive (which is somewhat hard to avoid in XSLT), the whole process really does not become any more complicated. The context ‘pointer’ is moved around, and templates get called.

    You can restrict the node set that apply-templates iterates over, using the select attribute:

    <!-- all children of the context node regardless --> <xsl:apply-templates />    <!-- all children of the context node being 'data' with a @name of 'Foo' --> <xsl:apply-templates select='data[@name='Foo']' />   

    You can sort the node-set prior to the iteration, if you wish:

    <!-- all children of the context node being 'data' with a @name of 'Foo',      ordered by their respective 'detail' count --> <xsl:apply-templates select='data[@name='Foo']'>    <xsl:sort select='count(detail)' data-type='number' order='descending'/> </xsl:apply-templates> 

    And you can pass parameters to your template if you need, just like you would with a regular function call:

    <!-- pass in some parameter --> <xsl:apply-templates select='data[@name='Foo']'>    <xsl:with-param name='DateSetIcon' select='$img_src' /> </xsl:apply-templates> 

    That’s about all there is to it.

    EDIT:

    I know that the last comment is a bit provocative. This is very much intentional, for a basic understanding of how apply-templates works this is more or less it. The implications and possibilities that come from the fact that not you are defining what template to call, but rather let the processor choose the right one for you are of course bigger than what it sounds like to the untrained ear. The declarative/implicit approach of the whole thing surely needs some time to sink in.

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

Sidebar

Ask A Question

Stats

  • Questions 123k
  • Answers 123k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I assume you're using PIL (Python Imaging Library). You need… May 12, 2026 at 1:03 am
  • Editorial Team
    Editorial Team added an answer All the fun stuff happens in this line: IL_0014: callvirt… May 12, 2026 at 1:03 am
  • Editorial Team
    Editorial Team added an answer Both ways look like they would consume roughly similar space… May 12, 2026 at 1:03 am

Related Questions

I converted my whole site to XML/XSL and I would like to know all
How can I define a [OperationContract] [WebGet] method to return XML that is stored
I get the following error: javax.servlet.ServletException: Cannot find a matching 1-argument function named {http://exslt.org/dynamic}evaluate()
I am running into the same problem as in this question: How do you

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.