How to change the value of XSL with-param value through JavaSCript

How to change the value of a <xsl: with-param > Value through JavaScript?
ChamarthiAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gertone (Geert Bormans)Information ArchitectCommented:
I can imagine that you want to change a value from an xsl:param whilst calling your XSLT from javascript
For that you need a template processor and use addParameter
The xsl:param also needs to be global to the stylesheet then

If that is not what you want, I need more info on what you exactly want to do... and why.
Inside a stylesheet, javascript would only work in msxml and xalan as a processor

so... more info please
0
ChamarthiAuthor Commented:
Hello Experts..
My Code is like this...
<td id="ModelButtonOK">
        <xsl:call-template name="Button">
               <xsl:with-param name="label" select="Ok" />
               <xsl:with-param name="id" select="modelButtonClickOk" />
        </xsl:call-template>
</td>

Now I want to read the parameter Name 'label' and change the value to 'Submit' in JavaScript..
Please pass any information on how to do this? Please send me a Hint...

Thanks,
Varma
0
ChamarthiAuthor Commented:
>>>>Inside a stylesheet, javascript would only work in msxml and xalan as a processor
  Not inside of the xsl. I am getting the id of getElementById('ModelButtonOK'). How can I traverse the sibblings of this parent node? and How can I get the name of the <label> and change the vale?
May be this is a basic question. Please provide any information?

0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Gertone (Geert Bormans)Information ArchitectCommented:
So, this clarifies your question quiet a bit.
(I hope you understand that your original question was lacking crucial information)

Can you now show me how that you call the XSLT?
I assume you are having browser JavaScript (some sort of AJAX) or that you are doing this in ASP

I don't recommend that you change the XSLT using DOM methods.
I strongly recommend that you pass the value as a paramameter to the XSLT, as I suggested in my first comment

you would then have a param at the top level of your stylesheet
<xsl:param name="model_button_label"/>

and use it like this

<td id="ModelButtonOK">
        <xsl:call-template name="Button">
               <xsl:with-param name="label" select="$model_button_label" />
               <xsl:with-param name="id" select="modelButtonClickOk" />
        </xsl:call-template>
</td>

in order to help you with that, I need to know where the JavaScript is and have to see it

cheers

Geert

0
ChamarthiAuthor Commented:
I am writing the browser javascript and I am calling it directly from the xsl. have a look at below...

<xsl:attribute name="onclick">
<xsl:text>js.showModelDialog(some parameters)</xsl:text>
</xsl:attribute>

Now in the same xsl file i have declared the
<td id="ModelButtonOK">
        <xsl:call-template name="Button">
               <xsl:with-param name="label" select="Ok" />
               <xsl:with-param name="id" select="modelButtonClickOk" />
        </xsl:call-template>
</td>
...
In JavaScript
function showModelDialog()
{
 var okButton = document.getElementById(ModelButtonOK);
var okButton = document.getElementById(modelButtonClickOk);
//here I want to write a code to get the 'label' value and chnge it to 'Submit'

}
Hope you got the necessary information?
0
Gertone (Geert Bormans)Information ArchitectCommented:
well, you are not winning a prize for being accurate in your question :-(

So, basically you are constructing the browser javascript in your XSLT?
Is that correct???

Now we are getting somewhere.
Your original question has put me on the wrong foot.

There is no need to change the with-param, but the resulting button...
(the with-param will be gone in the resulting HTML, all that is left is the pure HTML/javascript)

what is in the named template "Button"?
I need to see the XML snippet that says
<xsl:template name="Button">
...

thanks

Geert
0
ChamarthiAuthor Commented:
I am looking for similar to like this..

Example: if you a HTML form..
<html>
<body>
 <input type=button name='mybutton" value="OK" onclick="callMe()">
</body></html>
<script type="javascript">
function callMe(){
      document.myform.mybutton<b>.value = "Submit";</b>

}
</script>

I want to just change the value of the button dynamically.
0
Gertone (Geert Bormans)Information ArchitectCommented:
well,
I don't think that you understand what I need.

in your template call, you have a with-param name="label"
This will finally result in a HTML construct.
I NEED to know where in the resulting HTML the $label will be put, in order to address that with a DOM construct in your JavaScript
For that I NEED to see what is in the XSLT named template,
so can you please post the XSLT snippet starting with
<xsl:template name="Button">
... and ending with ...
</xsl:template>

Thank you
Geert
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pellepCommented:
Looks to me like you're going at it a bit backwards. The XSLT would be processed by the browser when it loads the page. Once the page is loaded, any javascript you execute will only interact with the actual DOM of the page that was the result of the XSL transformation. Modifying the XSLT after the fact really doesn't make sense.

From what I can read from your posts, you're looking to modify the label of a button, for which there is no need to mess with the XSLT. Just modify the property in the DOM model directly (like you proposed in your last post above).

document.getElementById('modelButtonClickOk').value='Submit';
0
Gertone (Geert Bormans)Information ArchitectCommented:
@pellep
I came to a similar conclusion.
Your code would be OK, if his named template indeed would simply create a simple button
that is why I was waiting for having acces to the named template :-(
0
Gertone (Geert Bormans)Information ArchitectCommented:
I hate it when they do this ....
we are actually waiting for feedback from OP, lot of effort has gone in this question,
if the OP does not answer within the time given, close the question like this please
split
gertone: 22958494
pellep: 22959021
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.