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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:11:42+00:00 2026-05-26T04:11:42+00:00

<xsl:variable name=date1 select=2011-10-05/> <xsl:variable name=date2 select=2011-10-05/> <xsl:variable name=date3 select=2011-10-06/> <xsl:if test=$date2 = $date1 or

  • 0
<xsl:variable name="date1" select="2011-10-05"/>
<xsl:variable name="date2" select="2011-10-05"/>
<xsl:variable name="date3" select="2011-10-06"/>

<xsl:if test="$date2 = $date1 or $date2 &lt; $date1">
  ..do something
</xsl:if>

<xsl:if test="$date3 = $date1 or $date3 &gt; $date1">
 .. do something
</xsl:if>

Both should evaluate true, but the second if doesn’t. For the life of me I can’t comprehended why!

In the actual transform the dates themselves are being drawn from an XML document but debugging through VS2010 i can see the values are as above.

Must be something fairly fundamental i’m doing wrong – any help would be brilliant!

  • 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-26T04:11:43+00:00Added an answer on May 26, 2026 at 4:11 am

    I tried this in Oxygen/XML… select="2011-10-05 is being interpreted as an arithmetic expression, giving the value 1996 (2011 minus 10 minus 5) and "2011-10-06" is intrepreted as 1995.

    What you want is

    <xsl:variable name="date1" select="'2011-10-05'"/>
    <xsl:variable name="date2" select="'2011-10-05'"/>
    <xsl:variable name="date3" select="'2011-10-06'"/>
    

    Note the extra single quotes.

    From the XSLT 1.0 Specification:

    If the variable-binding element has a select attribute, then the value
    of the attribute must be an expression and the value of the variable
    is the object that results from evaluating the expression.

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

Sidebar

Related Questions

The relevant parts of the code: <xsl:variable name=apos>'</xsl:variable> <xsl:variable name=and select='&#039;' /> <xsl:value-of select=translate(products_name/node(),$and,$apos)/>
What I have is following: <xsl:variable name=myvar select=.//spss:category[((not @varName) or @varName=$colVarName) and @text=$series]/spss:cell/@text/> What
The following isn't working as intended: <xsl:template match=xs:complexType> <xsl:param name=prefix /> <xsl:if test=$prefix='core'> <xsl:variable
This code selects the nodes, I want to work on...: <xsl:variable name=rootTextpageNode select=$currentPage/ancestor-or-self::node [@level
I have this snippet of XSLT code: <xsl:variable name=key select=@*[1]/> But I need it
The following works for me: <xsl:variable name=core select=document('CoreMain_v1.4.0.xsd') /> <xsl:variable name=AcRec select=document('AcademicRecord_v1.3.0.xsd') /> <xsl:template
I have <xsl:for-each select=ancestor-or-self::*> <xsl:variable name=expression select=name() ></xsl:variable> </xsl:for-each> below I have href and
Given <xsl:variable name=datePrecision as=element()*> <p>Year</p> <p>Month</p> <p>Day</p> <p>Time</p> <p>Timestamp</p> </xsl:variable> The expression $datePrecision[5] returns
How can I retrieve the position of the current Para? <xsl:template match=Para> <xsl:variable name=PositionInDocument
I have the following XSLT code that almost does what I want: <xsl:variable name=scoredItems

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.