fn:current-date() doesn't work

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
DonbassComrade
Forum Newbie
Posts: 1
Joined: Tue Jul 18, 2006 5:57 am

fn:current-date() doesn't work

Post by DonbassComrade »

For some reasone fn:current-date() function doesn't work.

I have an xsl template

Code: Select all

<?xml version="1.0" encoding="iso-8859-1" ?> 
<xsl:stylesheet 
	version="1.0" 
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:fn="http://www.w3.org/2006/xpath-functions"
>

   <!-- some code in here -->

   <xsl:element name="date"><xsl:value-of select="fn:current-date()" /></xsl:element>

   <!-- some code in here -->

</xsl:stylesheet>
php script is quite simple

Code: Select all

// ...

	$doc = new DomDocument();
	$doc->load($dataSrc);

	$xsl = new DomDocument();
	$xsl->load($xslTemplate);

	$proc = new XsltProcessor;
	$proc->importStylesheet($xsl);

	$doc = $proc->transformToDoc($doc);
	echo($doc->saveXML());
In Apache error.log i see following messages
[error] PHP Warning: XSLTProcessor::transformToDoc() [<a href='function.XSLTProcessor-transformToDoc'>function.XSLTProcessor-transformToDoc</a>]: xmlXPathCompOpEval: function current-date not found in ...
[error] PHP Warning: XSLTProcessor::transformToDoc() [<a href='function.XSLTProcessor-transformToDoc'>function.XSLTProcessor-transformToDoc</a>]: Unregistered function in ...
[error] PHP Warning: XSLTProcessor::transformToDoc() [<a href='function.XSLTProcessor-transformToDoc'>function.XSLTProcessor-transformToDoc</a>]: xmlXPathCompiledEval: evaluation failed in ...
[error] PHP Warning: XSLTProcessor::transformToDoc() [<a href='function.XSLTProcessor-transformToDoc'>function.XSLTProcessor-transformToDoc</a>]: runtime error: file ... line ... element value-of in ...
[error] PHP Warning: XSLTProcessor::transformToDoc() [<a href='function.XSLTProcessor-transformToDoc'>function.XSLTProcessor-transformToDoc</a>]: xsltValueOf: text copy failed in ...
[error] PHP Fatal error: Call to a member function saveXML() on a non-object in ...

Does anybody have an idea? Is it a bug in xsl template or is it a php problem? Is it possible to fix somehow? My php version is 5.2.0-dev.

thanks
Post Reply