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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:31:53+00:00 2026-06-05T15:31:53+00:00

I have the following code <xsl:result-document href=output1/output3/index.html format=html> <html> <head> <SCRIPT LANGUAGE=JavaScript> function getParams()

  • 0

I have the following code

<xsl:result-document href="output1/output3/index.html" format="html">
 <html>
 <head>
<SCRIPT LANGUAGE="JavaScript">
function getParams() 
{
var idx = document.URL.indexOf('?');
var params = new Array();
if (idx != -1) {
var pairs = document.URL.substring(idx+1, document.URL.length).split('&amp;');
for (var i=0; i&lt;pairs.length; i++) {
nameVal = pairs[i].split('=');
params[nameVal[0]] = nameVal[1];
   }
}
return params;
}
params = getParams();
</SCRIPT>

<SCRIPT LANGUAGE="JavaScript">
val = unescape(params["value"]);
document.write("value = " + val);
</SCRIPT>
</head>

<body>
 <xsl:choose>
    <xsl:when test="a:id=''">
    <xsl:value-of select="a:name"/>
    </xsl:when>
 </xsl:choose>
</body>
</html>
</xsl:result-document>

i want to access the javascript variable ‘val’ in xsl:when’. I need the value so that I can run the condition. Any ideas – How to do it?

  • 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-05T15:31:54+00:00Added an answer on June 5, 2026 at 3:31 pm

    Saxon-CE is an XSLT 2.0 processor that runs in the browser. It’s compiled to JavaScript and provides a high level of JavaScript interoperability. JavaScript/DOM nodes, numbers, strings, boolean values and arrays (converted to XSLT 2.0 sequences) work relatively seamlessly across the JavaScript/XSLT interface.

    For your specific case you have various options in Saxon-CE; you can directly call an existing or injected JavaScript function using ixsl:call() or you can use ixsl:get() to retrieve the value of a variable. Or, you can do the whole thing from within your XSLT 2.0:

    [Edited with corrections mentioned in comment]

    XSLT Code

    Here’s the same code included as text instead of a graphic – without formatting

    <xsl:transform
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:ixsl="http://saxonica.com/ns/interactiveXSLT"
        xmlns:xs="http://www.w3.org/2001/XMLSchema"
        xmlns:f="urn:local-function"
        xmlns:a="urn:source-xml"
        extension-element-prefixes="ixsl"
        version="2.0"
    >
        <xsl:template match="/">
            <xsl:variable name="urlparams" select="ixsl:get(
                ixsl:get(ixsl:window(),'location'),
                'search')"
                as="xs:string"/>
            <xsl:variable name ="pairs" select="tokenize(substring($urlparams,2), '&amp;')"
                as="xs:string*"/>
            <xsl:variable name="value" select="f:getValue($pairs)"/>
            <p>value: <xsl:value-of select="$value"/></p>
            
            <xsl:choose>
                <xsl:when test="a:id eq $value">
                    <xsl:value-of select="a:name"/>
                </xsl:when>
            </xsl:choose>
        
        </xsl:template>
        
        <xsl:function name="f:getValue" as="xs:string*">
            <xsl:param name="pairs" as="xs:string*"/>
            <xsl:sequence select="for $p in $pairs,
               $v in substring-before($p, '=')
            return
                if ($v eq 'value')
                    then substring($p, string-length($v) + 2)
                else ()"/>
        </xsl:function>
    
    </xsl:transform>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have used the following code in my XSL: <xsl:variable name=link select=normalize-space(concat('#',$chapter2))/> <a href={$link}>Next
I have the following code: <xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform> <xsl:output method=html /> <xsl:key name=categories match=Category
I have something like the following code:: <xsl:variable name=sample> <xsl:copy-of select=//foo> <xsl:copy-of select=//bar> </xsl>
I have following code. ASPX Page <a href=AnyASPXPageOfWebsite.aspx onclick=javascript:CallJQuery(); > Set Price </a> JS
I have the following XSLT code that almost does what I want: <xsl:variable name=scoredItems
I have the following code that applies a XSLT style Test.Xml.xslTransform = function(xml, xsl)
I have the following code, that inserts the processing instructions before root element: Document
I have the following xsl code. All I want to do is, output the
I have the following code block in my xslt; <xsl:when test=StatusData/Status/Temperature > 27> <td
I have following code in initialization im = imread('Image02.tif'); figure(); imagesc(im); colormap(gray); [hImage hfig

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.