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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:04:34+00:00 2026-05-26T21:04:34+00:00

I had the following definition for a variable <xsl:variable name=DataType select=@DataType/> Which works just

  • 0

I had the following definition for a variable

<xsl:variable name="DataType" select="@DataType"/>

Which works just fine…

Now I want to set its value using a condition like this

<xsl:variable name="DataTypeOverrideType" select="$DataSource/@DataTypeOverrideType"/>
<xsl:variable name="DataType">
    <xsl:choose>
        <xsl:when test="$ObeyTypeOverride and $DataTypeOverride = 1">
            <xsl:value-of select="$DataTypeOverrideType"/>  
        </xsl:when>
        <xsl:otherwise>
            <xsl:value-of select="@DataType"/>      
        </xsl:otherwise>
    </xsl:choose>
</xsl:variable>

But i;m getting the following error :

reference to variable or parameter ‘DataType’ must evaluate to a node list

I also tried the simplest example, like this

<xsl:variable name="DataType">
    <xsl:value-of select="@DataType"/>      
</xsl:variable>

but I keep on getting the error 😐

After the changes i did to the way of defining the variable i’m trying to use it , like this

<xsl:when test="$DataType = 'ReachEdit'">

and like this

<xsl:when test="$DataType = 9">

any ideas on how can i solve this issue?

Thanks ahead!

  • 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-26T21:04:34+00:00Added an answer on May 26, 2026 at 9:04 pm

    This isuue is due to the fact that you define a variable having an RTF (Result-Tree-Fragment) type. In order to use the contents of this variable as a regular tree, you must first convert it to a regular tree using an xxx:node-set() extension function, where the prefix "xxx:" must be bound to an implementation (vendor-provided) namespace.

    Also, the provided code snippet doesn’t make sense:

    <xsl:variable name="DataType"> 
        <xsl:choose> 
            <xsl:when test="$ObeyTypeOverride and $DataTypeOverride = 1"> 
                <xsl:value-of select="@DataType"/>   
            </xsl:when> 
            <xsl:otherwise> 
                <xsl:value-of select="@DataType"/>       
            </xsl:otherwise> 
        </xsl:choose> 
    </xsl:variable> 
    

    In both cases above the same value is output!

    My guess is that you want something like this:

    <xsl:variable name="DataType"> 
        <xsl:choose> 
            <xsl:when test="$ObeyTypeOverride and $DataTypeOverride = 1"> 
                <xsl:value-of select="@DataType1"/>   
            </xsl:when> 
            <xsl:otherwise> 
                <xsl:value-of select="@DataType2"/>       
            </xsl:otherwise> 
        </xsl:choose> 
    </xsl:variable> 
    

    In such a case it is possible in XPath 1.0 to define the variable without creating an RTF:

    <xsl:variable name="DataType" select=
      "@DataType1[$ObeyTypeOverride and $DataTypeOverride = 1]
      |
       @DataType2[not($ObeyTypeOverride and $DataTypeOverride = 1)]
    " /> 
    

    Update: The question is now updated with corrected snippet and example of the actual uses of the variable, that cause the error message.

    As the variable is used as atomic value, the error message shouldn’t be raised if the following XPath expressions are used:

    string($DataType) = 'ReachEdit'
    

    and

    number($DataType) = 9
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assuming the following view model definition: public class MyObject { public string Name {
I had the following code, which was basically, class foo { public: void method();
I'm getting started with cucumber, and I have written the following step definition, which
I am stumped by the following code: <b><i>First name *</b></i> : <input type=text name='<?php
Am I violating the One Definition Rule with the following program? // foo.hpp #ifndef
Pythonistas: Suppose you want to parse the following string using Pyparsing: 'ABC_123_SPEED_X 123' were
I have a problem set for my programming class which I'm working on. The
I had the following C++ code, where the argument to my constructor in the
Say I had the following code: % Cellmode_subfunction_test.m %% Cell 1 foo(1); %% Cell
I had come across the following code: typedef struct { double x; double y;

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.