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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:27:41+00:00 2026-05-12T11:27:41+00:00

Lets say I have a xslt stylesheet like the following: <?xml version=1.0 encoding=utf-8?> <xsl:stylesheet

  • 0

Lets say I have a xslt stylesheet like the following:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:exslt="http://exslt.org/common"
    exclude-result-prefixes="exslt"
    version="1.0">

<xsl:output method="html" encoding="utf-8" indent="no" />
<xsl:variable name="foo" value="'foo'" />
<xsl:variable name="bar" value="'bar'" />

</xsl:stylesheet>

What is the order of execution here? Is it guaranteed that global variable $foo will evaluate before global variable $bar? (If it’s dependent on the processing engine, I’m using libxslt).

  • 1 1 Answer
  • 1 View
  • 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-12T11:27:41+00:00Added an answer on May 12, 2026 at 11:27 am

    The order of evaluation is, in general, not guaranteed except where such guarantees follow from dependencies of expressions. For example:

    <xsl:variable name="foo" value="123" />
    
    <xsl:variable name="bar" value="456" />
    
    <xsl:variable name="baz" value="$foo + $bar" />
    
    <xsl:variable name="dummy" value="42 div 0" />
    
    <xsl:template match="/">
      <xsl:value-of select="$baz"/>
    </xsl:template>
    

    Here, it is certain that baz will get evaluated at some point prior to being output -maybe only immediately before being output, maybe at startup, maybe somewhere in between – and that foo and bar will be evaluated before baz – but the relative order of evaluation for foo and bar is not defined.

    dummy is an interesting case. It’s not actually used anywhere, and so could be omitted entirely, but, if my understanding of the spec is correct, the processor must nonetheless raise an error as if it was evaluated. At which point it does so is not important, because there’s no way to tell from inside XSLT – so dummy will be evaluated at some unspecified moment during execution (could be the first thing it does, or the last after all output is already generated), but is guaranteed to cause the transformation to fail with an error.

    This is all about XSLT and XPath 1.0. In 2.0, it is more relaxed – evaluation isn’t even required to happen at all; if processor can obtain a valid result by skipping evaluation of some expressions where otherwise they would result in error, it has a blanket permission to do so.

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

Sidebar

Related Questions

Let's say I have an XML node like the following: <item id=20> <name>Baz</name> <description>
Let's say I have a line in an XML file like the following (derived
Regarding Umbraco XSLT version 1. I have aprox. 150 news items in XML. Lets
Lets say I have XML that looks like so (and assume I can't alter
Lets say I have the following xml. <root> <data> <a>ATTITUDE_ANNOYED</a> <b>ATTITUDE_CAUTIOUS</b> <c>25</c> <d>30</d> </data>
Lets say we have a table here, populated with the following data: acc_id1 acc_id2
Lets Say i have a table like this WEB_LIST_TABLE KEY Value ---------------------------------------- 134 google.com
Lets say I have a class A that is fairly simple like this -
Lets say I have multiple commands like 5000 which updates some column and row
Let's say i have a full html-document as XML-input. How would the XSLT-file look

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.