RE: [xsl] Problem sending node Array to Javascript using .NET xsl/xml parse r

Subject: RE: [xsl] Problem sending node Array to Javascript using .NET xsl/xml parse r
From: "M. David Peterson" <conners_dad@xxxxxxx>
Date: Thu, 16 Oct 2003 02:21:50 -0700
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){
              nodeValue = value;
              return 0;
              return 1;

And heres the XSLT...

<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
put something in here to tell you that the value didnt get set correctly.

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,


From: "Joe Fawcett" <joefawcett@xxxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
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?



From: "Disalvo, Anthony J." <ANTHONY.J.DISALVO@xxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: "'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'" <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
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@xxxxxxxxxxxxxxxx] Sent: Tuesday, October 14, 2003 2:16 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] Problem sending node Array to Javascript using .NET xsl/xml parse r


At 12:25 PM 10/14/2003, you wrote:
>It is having a problem with the following line of code: <xsl:value-of
>It does not like the period/decimal point being sent in to the javascript
>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


which is the XPath expression commonly abbreviated as "."

Whether it works for you here is another question.


====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. 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:

XSL-List info and archive:

Find a cheaper internet access deal - choose one to suit you.

XSL-List info and archive:

Want to check if your PC is virus-infected? Get a FREE computer virus scan online from McAfee.

XSL-List info and archive:

Current Thread