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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:27:53+00:00 2026-05-28T14:27:53+00:00

Given An XSLT stylesheet with a global variable: <xsl:variable name=lang select=/response/str[@name=’lang’]/> Question Where from

  • 0

Given

An XSLT stylesheet with a global variable:

<xsl:variable name="lang" select="/response/str[@name='lang']"/>

Question

Where from comes the limitation that using variables in predicates is incorrect in the xsl:template matching pattern, but is acceptable in xsl:apply-templates selecting pattern?

<!-- throws compilation error, at least in libxslt --> 
<xsl:template match="list[@name='item_list'][$lang]"/>

<!-- works as expected --> 
<xsl:template match="list[@name='item_list'][/response/str[@name='lang']]"/>

<!-- works as expected --> 
<xsl:template match="response">
    <xsl:apply-templates select="list[@name='item_list'][$lang]">
</xsl:template>
  • 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-28T14:27:54+00:00Added an answer on May 28, 2026 at 2:27 pm

    Variables are not allowed to be used in match expressions in XSLT 1.0.

    From the XSLT 1.0 specification: Defining Template Rules

    It is an error for the value of the match attribute to contain a
    VariableReference.

    Variables are allowed in match expressions in XSLT 2.0.

    From the XSLT 2.0 specification: Syntax of Patterns

    Patterns may start with an id FO or key function call, provided that
    the value to be matched is supplied as either a literal or a reference
    to a variable or parameter, and the key name (in the case of the key
    function) is supplied as a string literal. These patterns will never
    match a node in a tree whose root is not a document node.

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

Sidebar

Related Questions

I have two XSLT variables as given below: <xsl:variable name=staticBaseUrl select='https://www.hello.com/htapi/PrintApp.asmx/getGames?contentId=id_sudoku&uniqueId=123456&pageformat=a4' /> <xsl:variable name=dynamicUrl
Question Using XSLT 1.0, given a string with arbitrary characters how can I get
Given a normal nhibernate config file: <?xml version=1.0?> <?xml-stylesheet type=text/xsl href=http://localhost/xmlStylesheets/nhibernate.xsl?> <hibernate-configuration xmlns=urn:nhibernate-configuration-2.2> <session-factory>
A while ago I asked this question: using xslt stylesheet to convert xhtml blank
(XSLT 1.0.) Given a variable called Rows which contains the following (example): Input <AllResults>
I have the following in xslt <?xml version=1.0 encoding=UTF-8?> <xsl:stylesheet version=2.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform xmlns:xs=http://www.w3.org/2001/XMLSchema xmlns:fn=http://www.w3.org/2005/02/xpath-functions
I'm trying to develop an XSLT stylesheet which transforms a given DocBook document to
Consider the following XSLT script: <?xml version=1.0 encoding=ISO-8859-1?> <xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform> <xsl:output method=text encoding=iso-8859-1/>
I am looking for a tool for semi-automatic XSLT generation. Given 2 XML files,
Given a select with multiple option's in jQuery. $select = $(<select></select>); $select.append(<option>Jason</option>) //Key =

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.