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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:08:28+00:00 2026-06-01T17:08:28+00:00

XSL: <xsl:if test=.[foo or @bar]> something </xsl:if> is it testing that if target is

  • 0

XSL:

<xsl:if test=".[foo or @bar]">
    something
</xsl:if>
  1. is it testing that if target is with ‘foo’ tag name or has a ‘bar’ attribute?

  2. it works only in IE, I’m wondering if there is an error. What is the equivalent sentence but works cross-browser?

  • 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-06-01T17:08:29+00:00Added an answer on June 1, 2026 at 5:08 pm
    <xsl:if test=".[foo or @bar]">     
      something 
    </xsl:if>
    

    In XSLT 1.0 this is syntactically invalid and produces an error.

    In XSLT 2.0 this is equivalent to:

     <xsl:if test="foo or @bar">     
       something 
     </xsl:if>
    

    The expression:

    foo or @bar
    

    evaluates to true() exactly when the context node (current node) has a child element named foo or the context node has an attribute named bar (or both).

    Otherwise this expression evaluates to false().

    Therefore, the above code snippet means: If either of these conditions is true: the current node has a child element named foo or the current node has an attribute named bar — then output the string “something”

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

Sidebar

Related Questions

I have a standard meta tag like this: <meta name=desc content=test/> That I want
I need to get the value of the 'test' attribute in the xsl:when tag,
I have a piece of code that look similar to this: <xsl:choose> <xsl:when test=some_test>
I am trying to remove the attribute xmlns=http://webdev2003.test.com from the following xml using xsl/xslt,
I have written the following XSLT template: <xsl:template match=foo:*> <xsl:processing-instruction name=php>$s = ob_get_clean(); ob_start();
I want to get an attribute from another element. E.g. <xsl:template match=tag1> Test: <xsl:value-of
Could xsl:variable be defined twice with same name in same scope. For code similar
I have an xsl:fo style sheet that refers to a URL which is an
Given an XSL 'If' statement: <xsl:if test=a = 'some value' and b = 'another
From this XML source : <?xml version=1.0 encoding=utf-8 ?> <ROOT> <STRUCT> <COL order=1 nodeName=FOO/BAR

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.