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

  • Home
  • SEARCH
  • 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 3360680
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T03:01:18+00:00 2026-05-18T03:01:18+00:00

I need to make a fork (depending on javascript enabled or not): <?xml version=1.0

  • 0

I need to make a fork (depending on javascript enabled or not):

<?xml version="1.0" encoding="windows-1251"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="no" encoding="windows-1251"/>
<xsl:template match="someNode">
    <xsl:variable name="vNoscript">
        <noscript>true</noscript>
    </xsl:variable>

    <xsl:choose>
        <!-- javascript disabled -->
        <xsl:when test="$vNoscript = 'true'">
            code branch 1
        </xsl:when>
        <!-- javascript enabled -->
        <xsl:otherwise>
            code branch 2           
        </xsl:otherwise>
    </xsl:choose>
</xsl:template>
</xsl:stylesheet>

This code is not working properly – the variable “vNoscript” in any case contains the value “true”.

What are some ways to solve the problem?

May be necessary to do such tests very differently?

Update 1: I run this code on server.

Update 2: I need to dynamically load the pictures on page (using javascript). For those who have disabled Javascript in browser I need to upload pictures “in the usual way.”

  • 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-18T03:01:18+00:00Added an answer on May 18, 2026 at 3:01 am

    Since you are running this code on the server you can’t know whether the client has JavaScript enabled or not.

    One way to circumvent this problem is by using an HTTP request parameter telling you whether to generate a JavaScript-enabled version of your page or not and the client decides which version to call:

    <script type="text/javascript">
     document.write("<a href='http://www.example.com/somepage.php?js=true'>Link</a>")
    </script>
    <noscript>
      <a href='http://www.example.com/somepage.php?js=false'>Link</a>
    </noscript>    
    

    Then you either call separate XSL transformations, or you can use a single, parameterized XLST.

    Update (after your edit):

    Simply create noscript content in your XSLT as you would do in static HTML:

    <?xml version="1.0" encoding="windows-1251"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html" indent="no" encoding="windows-1251"/>
    <xsl:template match="someNode">
        <!-- javascript enabled -->
        HTML/JavaScript to dynamically load images
    
        <noscript>fallback content</noscript>
    </xsl:template>
    </xsl:stylesheet>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a crystal report file I need make a tiny edit in. It
I need to make a WebCast presentation soon and need to do some whiteboarding
I need to make an application in .NET CF with different/single forms with a
I need to make an ArrayList of ArrayLists thread safe. I also cannot have
I need to make sure that user can run only one instance of my
I need to make a change to an ASP.NET web service written a couple
I need to make some reflective method calls in Java. Those calls will include
We need to make our enterprise ASP.NET/NHibernate browser-based application able to function when connected
I need to make changes to an in-use production database. Just adding a few
I need to make a piece of C# code interact through COM with all

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.