Assignment 10
My xsl file contains...
<xsl:param name="whatview" select="'Prefix'" />
<xsl:param name="prefix" select="'WEB'" />
<xsl:param name="proffessor" select="'VanBlargan'" />
...which I believe is correct.
But I searched a long time for the javascript to set these parameters, and have
found nothing.
I tried xsl.addParameter(x,y) and just get errors.
Can you please tell me, how can I pass values from the html controls to the xsl
file? That is the only step left that I can't seem to figure out.
David Gradwell
Had same problem, so I just created multiple xslt files, then based on the
choice from a drop down box loaded the appropriate xslt. I know there should be
a way of passing the paramter to the xslt, but because of time constraints and a
bit of frustration I just sort of "hammered it" to make it work.
in javascript something like
xslProc.addParameter("whatview", YourForm.YourSelect.value);
but that assumes you have the rest of html/javascript to go with it
complete example is at
http://www.oxygenxml.com/archives/xsl-list/200306/msg01127.html
but that is rather complicated, but shows all the rest of the code as well
sorry, I see you already tried
addParameter
I imagine, the problem (like many programming problems) is the
addParameter
does not fit in with how the rest of the html/javascript is coded
so in your example below, it may be the variable xsl is not coded correctly in
javascript...for example in my previous email, it assumes you had
xslProc = xslTemp.createProcessor();
xslProc.input = xml;
and then the lines for
xslProc.addParameter
so it is always hard to tell from a code snippet what the problem is cause it
could be a hangover from some code further up (or code that was not ever
present)
I never expected anyone to try
XSl with
addParameter method
but that is a great way to do it.
I assumed folks would just use javascript to write the xml out (without any
xsl). But I am impressed with the way you choose. I thought everyone would just
use javascript to loop thru the xml (DOM) tree and simply write out (maybe with
some html formatting) any elements that matched.
another example is
http://www.biglist.com/lists/xsl-list/archives/200503/msg00834.html
but again it is rather complicated and the key is adapting each statement (not
just the addParameter) to your code, realizing what names you can change and
what you cannot for example
xslproc.addParameter("sortKey", column);
only the
.addParameter has to be the same
so
xslproc
"sortKey",
column
all should be whatever names you have in your xml, xsl, html/javscript
are you sure you have
xsl x and Y defined properly (in previous statements)
before your line
xsl.addParameter(x,y)
what exactly are the errors
sometimes errors are vague like line 127
but sometimes may say like
"object xsl not defined line 21" which may mean you didnt defined xsl as a
variable
Are you just using xsl. and x,y as generalized examples or do you really have
variables called xsl, x, and y
just send me the all the files really