xsl-list
[Top] [All Lists]

RE: Using msxsl:script or EXSLT function to define a function

2003-06-18 05:06:57
Yes, sorry, but I posted before with all the info, and
I guess it was too much information, so I did it
briefly this last time to make it clear.

Lets put the code back, maybe you can answer to it.
Here goes...

======================================================
<XML ID="XSLHeader">
  <xsl:stylesheet version="1.0"
exclude-result-prefixes "xsl msxsl" 
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
        xmlns:js="javascript:code"
        xmlns:msxsl="urn:schemas-microsoft-com:xslt"
        xmlns:ms="urn:schemas-microsoft-com:xslt"
        xmlns:fo="http://www.w3.org/1999/XSL/Format";>

        <msxsl:script language="javascript"
implements-prefix="js">
           function factorial(n)
           {
                        if (n == '1')
                                { return ( 1 ) }
                        else 
                                { return ( n * factorial(n - 1) ) }
        }
        </msxsl:script>

                <xsl:param name="sexo"/>
                <xsl:param name="categ"/>
                <xsl:param name="anio"/>
                
                <xsl:template match="portfolio">
                
                <head>
                </head>
                <table border="2" width="100%" height="6">
                        <tr>
                        <td class="bg">
                        <H1><xsl:value-of
select="description"/> del <xsl:value-of
select="$anio"/> - <xsl:value-of select="$categ"/>
Años, 
                                        <xsl:choose>
                                                        <xsl:when
test="$sexo='V'">Varones</xsl:when>
                                                                
<xsl:otherwise>Damas</xsl:otherwise>
                                                        </xsl:choose>
                                                        
                                                </H1>
                        <H3>Actualizado el
<xsl:apply-templates select="date"/>
                                                </H3>
                                                <H3>Factorial <xsl:value-of
select="factorial(5)"/>
                                                </H3>
                                                <P>Presione sobre los 
encabezados para ordenar
por dicho campo.</P>
                        </td>
                        </tr>
        </table>
                </xsl:template>
  
                <xsl:template match="date">
                <xsl:value-of select="ms:format-date(., 'd',
SP_ar)"/> de <xsl:value-of select="ms:format-date(.,
'MMMMM, yyyy', SP_ar)"/>
                        a las <xsl:value-of select="ms:format-time(.,
'hh:mm tt')"/>
                </xsl:template>

        </xsl:stylesheet>
</XML>

======================================================

I don't know why, but I'm not able to run the
javascript and the page presents an error.

Claudio.



--- Michael Kay <mhk(_at_)mhk(_dot_)me(_dot_)uk> wrote:
Does anybody know how to use msxsl:script to
define a 
javascript function, or EXSLT function definition?

I'm not able to use it inside xsl: without having
error.

Yes, lots of people know, and if you show them what
you're doing,
they'll be able to tell you where you are going
wrong.

Michael Kay


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



__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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