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 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 need make some action (dump statistical data) before the Dart program ends. The
I need make all of my posts update. I use bulk upload for store,
Need to make certain Ruby strings in my program to be immutable. What is
I need to make a administrative GUI with lots of functionality like lists, forms,
I need to make a moderate system like the one in fmylife.com. Basically the
I need to make a point in time branch, when we release a new
I need to make efficient d-dimensional points searching and also make efficient k-NN queries
I need to make a series (1-20) ajax calls and I need to have
I need to make a QT app to run on the startup of an
I need to make the top header of a report disappear. The part that

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.