hello,
I have this javascript code - function displayResult2(id)
-
{
-
xml=loadXMLDoc("anna.xml");
-
xsl=loadXMLDoc("c011.xsl");
-
-
// code for IE
-
if (window.ActiveXObject)
-
{
-
ex=xml.transformNode(xsl);
-
document.getElementById("right").innerHTML=ex;
-
}
-
// code for Mozilla, Firefox, Opera, etc.
-
else if (document.implementation && document.implementation.createDocument)
-
{
-
var xsltProcessor=new XSLTProcessor();
-
xsltProcessor.importStylesheet(xsl);
-
resultDocument = xsltProcessor.transformToFragment(xml,document);
-
document.getElementById("right").appendChild(resultDocument);
-
}
-
}
and I want to pass the variable id at the c011.xsl
after that.. how c011.xsl can recognize that variable? what's the syntax?
any help would be appreciated :)
13 2953 Dormilich 8,658
Recognized Expert Moderator Expert
very usefull article.. thnx!
so, i wrote that line of code : - xsltProcessor.setParameter(null, "id", xsl);
I don't know why i put xsl in the parameters but alternatively it's not working.
I added the xsl param at c011.xsl
but the xsl if condition does not work :( - <xsl:if test="did/unitid='$id'">
- xsl tranformation
-
</xsl:if>
-
maybe the syntax is wrong..
but I don't know how to solve this.. i google it i changed it hundred of times but still failure...
Dormilich 8,658
Recognized Expert Moderator Expert
try - <xsl:if test="did/unitid/text() = $id">
No, it doesn't work..
I added ' ' but still nothing.. - <xsl:if test="did/unitid/text() = '$id'">
maybe the variable from javascript didn't pass successfully?
Dormilich 8,658
Recognized Expert Moderator Expert
I deliberately omitted the ' '.
further, what does "/did/unitid" return normally, a node or a nodeset?
With or without ' '
I don't see xsl transformation
Dormilich 8,658
Recognized Expert Moderator Expert
does it work, when you do it manually?
A node,
well when i choose one of 106 unitid, my xml file has,
for example 'L7346'
"/did/unitid='L7346'"
I see the result i want.
Dormilich 8,658
Recognized Expert Moderator Expert
well, I’ve never done XSLT in JavaScript (for obvious reasons) so I’m not of much help in debugging this. Personally, I prefer server-side XSLT, esp. since AJAX (target.appendChild(XHR.responseXML.documentElement );).
well,
I suppose I have made wrong the syntax of this
xsltProcessor.setParameter(null, "id", xsl);
anyway, thank you very very much for your interest and help ! I hope to find a solution asap.. :)
Dormilich 8,658
Recognized Expert Moderator Expert
now that you mention it, yes. (look at the example provided) the 3rd parameter of .setParameter() is the value of the parameter, where you passed the XSL file.
well yes the syntax was wrong
i corrected the code but
id is a variable but when i write it like that:
xsltProcessor.setParameter(null, "uid", "id")
it passes to c011.xsl like a static text "id" that's why I could not see result the condition was always false
do you know how can i pass it dynamically?
what i Have to write at the 3rd parameter exactly?
I found it i didn't need " ".
so the right syntax is
xsltProcessor.setParameter(null, "uid", id);
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: weiwei |
last post by:
Hi all
I am having trouble, let's say, I have a form text field, and I want
to pass it to the next page, however, I don not want to use submitted
button, instead I want to have a variable in link...
|
by: Wayne Baswell |
last post by:
I want to pass a date variable to a sql statement from Crystal
Reports. The part of the query accepting the variables looks like:
"Calendar_Date between To_Date('1-JUN-03','mm/dd/yy') and...
|
by: Sharon |
last post by:
Hi!
After transforming XML to CSV format I open an HTA to save the CSV to
the client. All goes well, the function looks like this:
function buttonExportClick()
{
var xslt = new...
|
by: GB |
last post by:
Hello:
In my MS Access project I have two objects - my form and my report.
I need to pass variable value from
Command_click procedure of my form to
Report_open procedure of my report.
How can I...
|
by: Ben Kial |
last post by:
I'd like to write a wrapper function "mysprintf(char *buffer, char *format,
....)" which calls sprintf(). My question is how can I pass variable argument
in mysprintf() to sprintf().
Thanks in...
| |
by: darrel |
last post by:
I'm still trying to fully understand how best to pass variables between
pages/usercontrols/each other.
On a current site I've done, I've had one userControl do the logic and set
the variable,...
|
by: dollar |
last post by:
I want to ask what is the best way to pass variable between asp.net we
pages, and user controls , any examples
-
dolla
-----------------------------------------------------------------------...
|
by: drec |
last post by:
I need to pass a variable from script1.php to script2.php. The problem
is that these scripts use frames and therefore I am able to pass the
variable through the URL. It also does not use forms to...
|
by: vijaynarang |
last post by:
strCmdLine = " " + " -o restore -url " + sSitePath + "/sites/" + sToplevelSiteName + " -filename " + sFileName+ " -overwrite ";
process1 =...
|
by: simon2x1 |
last post by:
i have a page which is home.php on that page i have a CSS tab which is tab1 and tab2 on that page in both tabs i have a link called next that pass variable to the next page (<a...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |