|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Problem sending node Array to Javascript using .NE
It seems to me that one of three things are happening... One, the content of
the context node is empty an therefore returns an empty string (the JScript
engine they are using doesnt like empty strings). Two, there is a type
conversion issue that is not being addressed correctly in the transport to
the Javascript engine (ive seen this happen quite a bit, especially running
on top of .NET using XslTransform() ). Three, somehow the call to the
javascript function is interupting the connection to the current node and
therefore sends null or an empty string or NaN or whatever. There are a few
solutions I can think of, but the easiest to me would be this...
Within your loop set a variable equal to the context node. <xsl:variable name="current" select="."/> Then just call the variable from within the call to the Javascript function... <xsl:value-of select="local:formatSigfigs($current,'AvgLabQARecovery')"/> You could also set a javascript global variable to the value of the current node and then use that within the formatSigfigs() function. Heres the Javascript... var nodeValue; function setNodeValue(value){
try{
nodeValue = value;
return 0;
}
catch{
return 1;
}
}And heres the XSLT... <xsl:choose> <xsl:when test="local:setNodeValue(.) = 0"> <xsl:value-of select="local:formatSigfigs('AvgLabQARecovery')"/> //Note: change the local:formatSigFigs() function to use the global var 'nodeValue' to process and return the correct value </xsl:when> <xsl:otherwise> put something in here to tell you that the value didnt get set correctly. </xsl:otherwise> </xsl:choose> Using the above javascript variable solution would also allow you to call a returnValue function from an <xsl:value-of> element to determine what is actually being sent to the javascript function... Something like: function returnNodeValue(){ return nodeValue; } and then call it with: <xsl:value-of select="local:returnNodeValue()"/> If you are getting the correct string written out then at least you know youve got that part of the problem solved. I hope this helps! Best regards, M. From: "Joe Fawcett" <joefawcett@xxxxxxxxxxx> _________________________________________________________________ Want to check if your PC is virus-infected? Get a FREE computer virus scan online from McAfee. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








