Re: [xsl] xsl:script (again)

Subject: Re: [xsl] xsl:script (again)
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 7 Mar 2002 12:23:20 +0000
Hi Alia,

> But I got as output: SalesPosition=1 function SalesPos()
> SalesPos=SalesPosition SalesPosition=SalesPosition+1 end function
> function calcul(node) m=node.childnodes.item(1).text
> n=node.childnodes.item(2).text calcul=m*n end function

It looks as though the stylesheet isn't being interpreted properly. It
could be a couple of things:

  - are you accidentally running the transformation on the stylesheet
    rather than on the source document?
  - are you using MSXML2, which doesn't support XSLT?

You could try adding an extension-element-prefixes attribute to the
xsl:stylesheet element to state that the prefix 'msxsl' is being used
for extension elements, though I don't think that would make a
difference.

By the way, your function seems a little peculiar, since you can
easily get the position of a particular Salesperson through the
position() function. Rather than using your xslscript:SalesPos()
function, why not just do:

<xsl:template match="Salesperson">
 <tr>
  <td><xsl:value-of select="position()" /></td>
  <td><xsl:value-of select="Name" /></td>
  <td><xsl:value-of select="Sales" /></td>
 </tr>
</xsl:template>

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread