[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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

Subject: RE: Using msxsl:script or EXSLT function to define a function
From: "Dion Houston" <dionh@xxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 18 Jun 2003 05:39:59 -0700
using msxsl script
Hi Claudio:

Most of the problem is that this isn't valid XML :)

First you need to change the third line to exclude-result-prefixes="..." (you're missing the equals sign).  The other issue you're having is that you have accented characters encoded in ANSI.  The basic rule about encoding is that if an encoding can't be determined by other means, assume it's UTF-8.  If you take your stylesheet into notepad and save as UTF-8 that problem goes away.

Finally, why do you have an "XML" element as the root?  Any case combination of XML is reserved.

HTH!

Dion

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Claudio Russo
Sent: Wednesday, June 18, 2003 5:07 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  Using msxsl:script or EXSLT function to define a function

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@xxxxxxxxx> 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




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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.