![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries [Thread Prev] >Thread Next - Re: Problem calling functions from within XSLT? Problem calling functions from within XSLT?To: NULL Date: 1/13/2008 1:17:00 AM Hello. I hope someone can help. I can't for the life of me, seem to work out how to call functions from within XSLT code. I have a simple XSLT file (called function.xsl) which contains the following code ; <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fn="http://www.w3.org/2005/02/xpath-functions"> <xsl:output method='html' version='1.0' encoding='UTF-8' indent='yes'/> <xsl:template match="/"> <html> <body> <xsl:if test="fn:base-uri()" xmlns:fn="http://www.w3.org/2005/02/xpath-functions"> XSLT function call succeeded. </xsl:if> </body> </html> </xsl:template> </xsl:stylesheet> This code isn't meant to do anything useful - it is just the simplest piece of test code I could devise to try and distill the problem. My corresponding XML file (which is called function.xml) resides in the same directory as the XSLT file and its contents are as follows ; <?xml version="1.0" encoding="ISO-8859-1"?> <?xml-stylesheet type="text/xsl" href="function.xsl"?> <body> </body> When I attempt to load up this XML file into IE6 I get the following error ; The XML page cannot be displayed Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later. Namespace 'http://www.w3.org/2005/02/xpath-functions' does not contain any functions. When I load the XML file into the latest versions of Opera and Firefox, the diagnostic messages are even less helpful! They simply state that there was a problem processing the XSLT. So then I installed Saxon version 9.0 Base. When I process the two files using Saxon I get the following error message ; Error at xsl:if on line 21 of file:/D:/Documents%20and%20Settings/Craig%20Sanders/My%20Documents/xslt/function.xsl: XPST0017: XPath syntax error at char 13 on line 21 in {fn:base-uri()}: Cannot find a matching 0-argument function named {http://www.w3.org/2005/02/xpath-functions}base-uri() Failed to compile stylesheet. 1 error detected. Any help would be most appreciated. Thankyou. | ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
