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(_at_)hotmail(_dot_)com>
Reply-To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Problem sending node Array to Javascript using .NET
xsl/xml parse r
Date: Thu, 16 Oct 2003 08:41:08 +0100
I missed the first part of this, can you show a sample of the offending
code?
--
Joe
From: "Disalvo, Anthony J." <ANTHONY(_dot_)J(_dot_)DISALVO(_at_)saic(_dot_)com>
Reply-To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To: "'xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com'"
<xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Subject: RE: [xsl] Problem sending node Array to Javascript using .NET
xsl/xml parse r
Date: Wed, 15 Oct 2003 11:17:37 -0700
Thanks for the Idea, I tried this and it did not work.
-----Original Message-----
From: Wendell Piez [mailto:wapiez(_at_)mulberrytech(_dot_)com]
Sent: Tuesday, October 14, 2003 2:16 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Problem sending node Array to Javascript using .NET
xsl/xml parse r
Anthony,
At 12:25 PM 10/14/2003, you wrote:
>It is having a problem with the following line of code: <xsl:value-of
>select="local:formatSigfigs(.,'AvgLabQARecovery')"/>
>
>It does not like the period/decimal point being sent in to the
javascript
as
>a reference to the node.
>
>Any ideas on how to deal with this issue or alternatives on how tro
>reference the node not using the period / decimal point that will pass
the
>Microsoft parser's requirements?
I have no idea whatsoever as to working with the MS toolkit, but you might
try
self::node()
which is the XPath expression commonly abbreviated as "."
Whether it works for you here is another question.
Cheers,
Wendell
======================================================================
Wendell Piez
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9635
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
----------------------------------------------------------------------
Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
_________________________________________________________________
Find a cheaper internet access deal - choose one to suit you.
http://www.msn.co.uk/internetaccess
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
_________________________________________________________________
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