MyBB Community Forums

Full Version: Problem with php and xml
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
The errors are quite vague for me.
Basically:
[10-Feb-2012 10:15:07] PHP Warning:  XSLTProcessor::transformToXml() 
[<a href='xsltprocessor.transformtoxml'>xsltprocessor.transformtoxml</a>]:
 xmlXPathCompiledEval: 2 object left on the stack in /home/ansem/public_html/utils.php on line 119
[10-Feb-2012 10:15:07] PHP Warning:  XSLTProcessor::transformToXml() 
[<a href='xsltprocessor.transformtoxml'>xsltprocessor.transformtoxml</a>]: 
runtime error: file /home/ansem/public_html/templates/utils.xsl line 104 element variable in /home/ansem/public_html/utils.php on line 119
( Added some enters so the page won't stretch )

Content of the bottom part of the file:
	////////////////////////
	/// XSL Transformations

	function Numbers($from, $to) // creates comma-separated list of all integer values from interval <$from, $to>
	{
		if ($from <= $to) return implode(",", array_keys(array_fill($from, $to - $from + 1, 0)));
		else return "";
	}

	function array2xml(array $array)
	{
		$text = "";
		foreach($array as $key => $value)
		{
			if( is_numeric($key) )
				$key = "k".$key;

			if( !is_array($value) ) 
				$text .= "<$key>".htmlencode($value)."</$key>"; 
			else
				$text .= "<$key>".array2xml($value)."</$key>";
		}
		return $text;
	}

	function XSLT($xslpath, array $params)
	{
		// set up xslt
		$xsldoc = new DOMDocument();
		$xsldoc->load($xslpath);
		$xsl = new XSLTProcessor();
		$xsl->importStyleSheet($xsldoc);
		$xsl->registerPHPFunctions();

		// set up the params tree
		$tree = '<?xml version="1.0" encoding="UTF-8"?>'.'<params>'.array2xml($params).'</params>';

		// convert tree into xml document
		$xmldoc = new DOMDocument();
		$xmldoc->loadXML($tree, LIBXML_NOERROR);
		if( $xmldoc->hasChildNodes() == FALSE )
		{
			echo 'utils::XSLT : failed to load $params, check if there aren\'t any invalid characters in key names.'."\n\n";
			print_r($params);
			die();
		}
	
		// generate output
		return $xsl->transformToXML($xmldoc);
	}

?>
With the second last line:
		// generate output
		return $xsl->transformToXML($xmldoc);
being line 118 and 119

in utils.xml
<func:function name="am:datetime">
	<xsl:param name="datetime" as="xs:string" />
	<xsl:param name="timezone" as="xs:string" select="'+0'" />
	<xsl:variable name="date" select="str:replace($datetime, ' ', 'T')" />
	<xsl:variable name="zone" select="concat('Etc/GMT', str:replace(str:replace(str:replace($timezone, '+', '*'), '-', '+'), '*', '-'))" />
	<func:result select="php:functionString('ZoneTime', $date, $zone, 'H:i, j. M, Y')" />
</func:function>
with
	<xsl:variable name="date" select="str:replace($datetime, ' ', 'T')" />
being line 104

So what is going wrong ?
And could anyone help me fix it.
( Maybe a little explanation so I won't make the same mistake next time Wink )
I THINK I'M CLOSE NOW !

<func:function name="am:datetime">

    <xsl:param name="datetime" as="xs:string" />

    <xsl:param name="timezone" as="xs:string" select="'+0'" />

    <xsl:variable name="date" select="str:replace($datetime, ' ', 'T')" />

    <xsl:variable name="zone" select="concat('Etc/GMT', str:replace(str:replace(str:replace($timezone, '+', '*'), '-', '+'), '*', '-'))" />

    <func:result select="php:functionString('ZoneTime', $date, $zone, 'H:i, j. M, Y')" />

</func:function>

from utils.xml

The function "str:replace"

Is there an alternative way to do that ?

What I found is that it's either from a newer or older function, and used to be something like "translate instead of replace".

Didn't find a good explanation for it.

Anyway, this is the closest I got to a solution, as this explains the:

Quote:[15-Feb-2012 14:24:23] PHP Warning: XSLTProcessor::transformToXml() [<a href='xsltprocessor.transformtoxml'>xsltprocessor.transformtoxml</a>]: exsltFuncResultElem: ret == NULL in /home/ansem/public_html/utils.php on line 119

[15-Feb-2012 14:24:33] PHP Warning: XSLTProcessor::transformToXml() [<a href='xsltprocessor.transformtoxml'>xsltprocessor.transformtoxml</a>]: xmlXPathCompOpEval: function replace not found in /home/ansem/public_html/utils.php on line 119

[15-Feb-2012 14:24:33] PHP Warning: XSLTProcessor::transformToXml() [<a href='xsltprocessor.transformtoxml'>xsltprocessor.transformtoxml</a>]: Unregistered function in /home/ansem/public_html/utils.php on line 119

[15-Feb-2012 14:24:33] PHP Warning: XSLTProcessor::transformToXml() [<a href='xsltprocessor.transformtoxml'>xsltprocessor.transformtoxml</a>]: xmlXPathCompiledEval: 2 object left on the stack in /home/ansem/public_html/utils.php on line 119

[15-Feb-2012 14:24:33] PHP Warning: XSLTProcessor::transformToXml() [<a href='xsltprocessor.transformtoxml'>xsltprocessor.transformtoxml</a>]: runtime error: file /home/ansem/public_html/arcomage/templates/utils.xsl line 104 element variable in /home/ansem/public_html/utils.php on line 119

[15-Feb-2012 14:24:33] PHP Warning: XSLTProcessor::transformToXml() [<a href='xsltprocessor.transformtoxml'>xsltprocessor.transformtoxml</a>]: Evaluating variable date failed in /home/ansem/public_html/utils.php on line 119

SO HAPPY Big Grin
After all those days of trying to find the problem.
Could anyone redo that piece of code with the translate function instead of the replace function ?
I actually isolated the problem now.

It's all in one single file, which cooperates with utils.php

Now after googling and finding that I needed to replace replace() with translate() the errors went to function replace not found to function translate not found.

All went to that it can't define the date variables ( 'date' 'datetime_2' etc ).

So the faults are in here:

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0"

xmlns="[URL]http://www.w3.org/1999/xhtml[/URL]"

xmlns:xsl="[URL]http://www.w3.org/1999/XSL/Transform[/URL]"

xmlns:happy:ate="[URL]http://exslt.org/dates-and-times[/URL]"

xmlns:exsl="[URL]http://exslt.org/common[/URL]"

xmlns:func="[URL]http://exslt.org/functions[/URL]"

xmlns:php="[URL]http://php.net/xsl[/URL]"

xmlns:str="[URL]http://exslt.org/strings[/URL]"

extension-element-prefixes="date func php str">

<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="[URL]http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd[/URL]" />

<xsl:include href="date.format-date.function.xsl" /> <!-- date:format-date(string, string) -->

<xsl:include href="date.difference.function.xsl" /> <!-- date:happy:ifference(string, string) -->

<func:function name="am:urlencode">

<xsl:param name="string" as="xs:string" />

<func:result select="str:encode-uri($string, true())" />

</func:function>

<func:function name="am:textencode">

<xsl:param name="text" as="xs:string" />

<!-- change newlines into html paragraphs -->

<xsl:variable name="lines" select="str:split($text, '
')" />

<xsl:variable name="output">

<xsl:for-each select="$lines">

<!-- change urls into html hyperlinks -->

<xsl:variable name="words" select="str:split(text(), ' ')"/>

<xsl:for-each select="$words">

<xsl:if test="position() != 1">

<xsl:text> </xsl:text>

</xsl:if>

<xsl:choose>

<xsl:when test="contains(text(), '[URL]http://[/URL]')">

<xsl:value-of select="substring-before(text(), '[URL]http://[/URL]')"/>

<a href="[URL]http://{substring-after(text([/URL]), '[URL]http://')}[/URL]">[URL]http://<xsl:value-of[/URL] select="substring-after(text(), '[URL]http://[/URL]')"/></a>

</xsl:when>

<xsl:when test="contains(text(), '[URL]https://[/URL]')">

<xsl:value-of select="substring-before(text(), '[URL]https://[/URL]')"/>

<a href="[URL]https://{substring-after(text([/URL]), '[URL]https://')}[/URL]">[URL]https://<xsl:value-of[/URL] select="substring-after(text(), '[URL]https://[/URL]')"/></a>

</xsl:when>

<xsl:otherwise>

<xsl:value-of select="text()"/>

</xsl:otherwise>

</xsl:choose>

</xsl:for-each>

<br/>

</xsl:for-each>

</xsl:variable>

<func:result select="$output" />

</func:function>

<func:function name="am:autorefresh">

<xsl:param name="refresh_rate" as="xs:integer" />

<!-- autorefresh JavaScript element -->

<xsl:variable name="output">

<xsl:element name="script">

<xsl:attribute name="type">text/javascript</xsl:attribute>

<xsl:text>$(document).ready(function() { window.setTimeout('Refresh()', </xsl:text>

<xsl:value-of select="$refresh_rate" />

<xsl:text>000); });</xsl:text>

</xsl:element>

</xsl:variable>

<func:result select="$output" />

</func:function>

<func:function name="am:min">

<xsl:param name="num1" as="xs:integer" />

<xsl:param name="num2" as="xs:integer" />

<func:result>

<xsl:choose>

<xsl:when test="$num1 &lt; $num2"><xsl:value-of select="$num1"/></xsl:when>

<xsl:otherwise><xsl:value-of select="$num2"/></xsl:otherwise>

</xsl:choose>

</func:result>

</func:function>

<func:function name="am:max">

<xsl:param name="num1" as="xs:integer" />

<xsl:param name="num2" as="xs:integer" />

<func:result>

<xsl:choose>

<xsl:when test="$num1 &gt; $num2"><xsl:value-of select="$num1"/></xsl:when>

<xsl:otherwise><xsl:value-of select="$num2"/></xsl:otherwise>

</xsl:choose>

</func:result>

</func:function>

<func:function name="am:happy:atetime">

<xsl:param name="datetime" as="xs:string" />

<xsl:param name="timezone" as="xs:string" select="'+0'" />

<xsl:variable name="date" select="str:replace($datetime, ' ', 'T')" />

<xsl:variable name="zone" select="concat('Etc/GMT', str:replace(str:replace(str:replace($timezone, '+', '*'), '-', '+'), '*', '-'))" />

<func:result select="php:functionString('ZoneTime', $date, $zone, 'H:i, j. M, Y')" />

</func:function>

<func:function name="am:format-date">

<xsl:param name="date" as="xs:string" />

<func:result select="date:format-date($date, 'd. MMM, yyyy')" />

</func:function>

<func:function name="am:lowercase">

<xsl:param name="string" as="xs:string" />

<xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'"/>

<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>

<func:result select="translate($string, $uppercase, $smallcase)" />

</func:function>

<func:function name="am:BBCode_parse">

<xsl:param name="orig_content" as="xs:string" />

<func:result select="php:functionString('parse_post', $orig_content)" />

</func:function>

<func:function name="am:BBCode_parse_extended">

<xsl:param name="orig_content" as="xs:string" />

<func:result select="php:functionString('parse_post', $orig_content, 'true')" />

</func:function>

<func:function name="am:BBcodeButtons">

<xsl:param name="target" as="xs:string" />

<xsl:variable name="buttons">

<div id="{$target}" class="BBcodeButtons">

<button type="button" name="bold" title="Bold">B</button>

<button type="button" name="italics" title="Italics">I</button>

<button type="button" name="link" title="Internal hyperlink">Link</button>

<button type="button" name="url" title="External hyperlink">Url</button>

<button type="button" name="quote" title="Quote">Quote</button>

</div>

</xsl:variable>

<func:result select="exsl:node-set($buttons)"/>

</func:function>

<func:function name="am:happy:atediff">

<xsl:param name="datetime1" as="xs:string" />

<xsl:param name="datetime2" as="xs:string" />

<xsl:variable name="datetime2_fix" select="str:replace($datetime2, '0000-00-00 00:00:00', '1970-01-01 00:00:00')" />

<func:result select="date:seconds(date:happy:ifference(str:replace($datetime1, ' ', 'T'), str:replace($datetime2_fix, ' ', 'T')))" />

</func:function>

<func:function name="am:upper_navigation">

<xsl:param name="page_count" as="xs:integer" />

<xsl:param name="current" as="xs:integer" />

<xsl:param name="button_name" as="xs:string" />

<xsl:variable name="output">

<!-- previous -->

<button type="submit" name="{concat('select_page_', $button_name)}" value="{am:max($current - 1, 0)}">

<xsl:if test="$current = 0">

<xsl:attribute name="disabled">disabled</xsl:attribute>

</xsl:if>

<xsl:text>&lt;</xsl:text>

</button>

<!-- first -->

<button type="submit" name="{concat('select_page_', $button_name)}" value="0">

<xsl:if test="$current = 0">

<xsl:attribute name="disabled">disabled</xsl:attribute>

</xsl:if>

<xsl:text>First</xsl:text>

</button>

<xsl:if test="$page_count &gt; 0">

<!-- page selecion -->

<xsl:for-each select="str:split(am:numbers(am:max($current - 5, 0), am:min($current + 5, am:max($page_count - 1, 0))), ',')">

<button type="submit" name="{concat('select_page_', $button_name)}" value="{text()}">

<xsl:if test="$current = .">

<xsl:attribute name="disabled">disabled</xsl:attribute>

</xsl:if>

<xsl:value-of select="text()"/>

</button>

</xsl:for-each>

</xsl:if>

<!-- last -->

<button type="submit" name="{concat('select_page_', $button_name)}" value="{am:max($page_count - 1, 0)}">

<xsl:if test="$current = am:max($page_count - 1, 0)">

<xsl:attribute name="disabled">disabled</xsl:attribute>

</xsl:if>

<xsl:text>Last</xsl:text>

</button>

<!-- next -->

<button type="submit" name="{concat('select_page_', $button_name)}" value="{am:min($current + 1, $page_count - 1)}">

<xsl:if test="$current = am:max($page_count - 1, 0)">

<xsl:attribute name="disabled">disabled</xsl:attribute>

</xsl:if>

<xsl:text>&gt;</xsl:text>

</button>

</xsl:variable>

<func:result select="$output" />

</func:function>

<func:function name="am:lower_navigation">

<xsl:param name="page_count" as="xs:integer" />

<xsl:param name="current" as="xs:integer" />

<xsl:param name="arrow_button" as="xs:string" />

<xsl:param name="back_button" as="xs:string" />

<xsl:variable name="output">

<!-- arrow buttons selector -->

<button type="submit" name="{concat('select_page_', $arrow_button)}" value="{am:max($current - 1, 0)}">

<xsl:if test="$current = 0">

<xsl:attribute name="disabled">disabled</xsl:attribute>

</xsl:if>

<xsl:text>&lt;</xsl:text>

</button>

<button type="submit" name="Refresh" value="{$back_button}">Back to top</button>

<button type="submit" name="{concat('select_page_', $arrow_button)}" value="{am:min($current + 1, $page_count - 1)}">

<xsl:if test="$current = am:max($page_count - 1, 0)">

<xsl:attribute name="disabled">disabled</xsl:attribute>

</xsl:if>

<xsl:text>&gt;</xsl:text>

</button>

</xsl:variable>

<func:result select="$output" />

</func:function>

<func:function name="am:page_list">

<xsl:param name="count" as="xs:integer" />

<func:result select="str:split(am:numbers(0, $count - 1), ',')" />

</func:function>

<func:function name="am:numbers">

<xsl:param name="from" as="xs:integer" />

<xsl:param name="to" as="xs:integer" />

<func:result select="php:functionString('Numbers', $from, $to)" />

</func:function>

<func:function name="am:simple_navigation">

<xsl:param name="location" as="xs:string" />

<xsl:param name="page_type" as="xs:string" />

<xsl:param name="current" as="xs:integer" />

<xsl:param name="page_count" as="xs:integer" />

<xsl:variable name="output">

<xsl:choose>

<xsl:when test="$current &gt; 0">

<a class="button" href="{php:functionString('makeurl', $location, $page_type, am:max($current - 1, 0))}">&lt;</a>

</xsl:when>

<xsl:otherwise>

<span class="disabled">&lt;</span>

</xsl:otherwise>

</xsl:choose>

<xsl:choose>

<xsl:when test="$current &gt; 0">

<a class="button" href="{php:functionString('makeurl', $location, $page_type, 0)}">First</a>

</xsl:when>

<xsl:otherwise>

<span class="disabled">First</span>

</xsl:otherwise>

</xsl:choose>

<xsl:for-each select="str:split(am:numbers(am:max($current - 5, 0), am:min($current + 5, am:max($page_count - 1, 0))), ',')">

<xsl:choose>

<xsl:when test="$current != .">

<a class="button" href="{php:functionString('makeurl', $location, $page_type, text())}"><xsl:value-of select="text()"/></a>

</xsl:when>

<xsl:otherwise>

<span class="disabled"><xsl:value-of select="text()"/></span>

</xsl:otherwise>

</xsl:choose>

</xsl:for-each>

<xsl:choose>

<xsl:when test="$current &lt; am:max($page_count - 1, 0)">

<a class="button" href="{php:functionString('makeurl', $location, $page_type, am:max($page_count - 1, 0))}">Last</a>

</xsl:when>

<xsl:otherwise>

<span class="disabled">Last</span>

</xsl:otherwise>

</xsl:choose>

<xsl:choose>

<xsl:when test="$current &lt; am:max($page_count - 1, 0)">

<a class="button" href="{php:functionString('makeurl', $location, $page_type, am:min($current + 1, am:max($page_count - 1, 0)))}">&gt;</a>

</xsl:when>

<xsl:otherwise>

<span class="disabled">&gt;</span>

</xsl:otherwise>

</xsl:choose>

</xsl:variable>

<func:result select="$output" />

</func:function>

<func:function name="am:htmlSelectBox">

<!-- generates html select box -->

<xsl:param name="name" as="xs:string" />

<xsl:param name="current" as="xs:string" />

<xsl:param name="static_values" as="xs:node-set" />

<xsl:param name="dynamic_values" as="xs:node-set" />

<xsl:variable name="converted">

<xsl:for-each select="exsl:node-set($dynamic_values)/*">

<value name="{text()}" value="{text()}" />

</xsl:for-each>

</xsl:variable>

<xsl:variable name="values" select="exsl:node-set($static_values) | exsl:node-set($converted)" />

<xsl:variable name="output">

<select name="{$name}">

<xsl:if test="$current != 'none'">

<xsl:attribute name="class">filter_active</xsl:attribute>

</xsl:if>

<xsl:for-each select="$values/*">

<option value="{@value}">

<xsl:if test="$current = @value">

<xsl:attribute name="selected">selected</xsl:attribute>

</xsl:if>

<xsl:value-of select="@name"/>

</option>

</xsl:for-each>

</select>

</xsl:variable>

<func:result select="$output" />

</func:function>

<func:function name="am:cardeffect">

<xsl:param name="effect" as="xs:string" />

<!-- ad-hoc html entity corrections -->

<xsl:variable name="replace">

<from> &lt; </from><to> &amp;lt; </to>

<from> &gt; </from><to> &amp;gt; </to>

<from> &lt;= </from><to> &amp;lt;= </to>

<from> &gt;= </from><to> &amp;gt;= </to>

</xsl:variable>

<func:result select="str:replace($effect, exsl:node-set($replace)/*[local-name()='from'], exsl:node-set($replace)/*[local-name()='to'])" />

</func:function>

<func:function name="am:file_name">

<xsl:param name="name" as="xs:string" />

<func:result select="am:lowercase(str:replace($name, ' ', '_'))" />

</func:function>

<func:function name="am:cardstring">

<xsl:param name="card" />

<xsl:param name="c_img" select="'yes'" />

<xsl:param name="c_oldlook" select="'no'" />

<xsl:param name="c_insignias" select="'yes'" />

<xsl:param name="c_foils" select="''" />

<xsl:param name="c_new" select="false()" />

<xsl:param name="c_revealed" select="false()" />

<xsl:param name="keywords_count" select="false()" />

<xsl:variable name="cardstring">

<xsl:variable name="class">

<xsl:choose>

<xsl:when test="$card/class = 'Common'"> common_class</xsl:when>

<xsl:when test="$card/class = 'Uncommon'"> uncommon_class</xsl:when>

<xsl:when test="$card/class = 'Rare'"> rare_class</xsl:when>

<xsl:otherwise> no_class</xsl:otherwise>

</xsl:choose>

</xsl:variable>

<xsl:variable name="type">

<xsl:choose>

<xsl:when test="$card/bricks = 0 and $card/gems = 0 and $card/recruits = 0">

<xsl:text> zero_cost</xsl:text>

</xsl:when>

<xsl:when test="$card/bricks &gt; 0 and $card/gems = 0 and $card/recruits = 0">

<xsl:text> bricks_cost</xsl:text>

</xsl:when>

<xsl:when test="$card/bricks = 0 and $card/gems &gt; 0 and $card/recruits = 0">

<xsl:text> gem_cost</xsl:text>

</xsl:when>

<xsl:when test="$card/bricks = 0 and $card/gems = 0 and $card/recruits &gt; 0">

<xsl:text> rec_cost</xsl:text>

</xsl:when>

<xsl:otherwise>

<xsl:text> mixed_cost</xsl:text>

</xsl:otherwise>

</xsl:choose>

</xsl:variable>

<xsl:variable name="bgimage">

<xsl:if test="$c_oldlook = 'no'"> with_bgimage</xsl:if>

</xsl:variable>

<xsl:variable name="foil">

<xsl:if test="contains(concat(',', $c_foils, ','), concat(',', $card/id, ','))"> foil</xsl:if>

</xsl:variable>

<div class="karta{$class}{$type}{$bgimage}{$foil}">

<!-- display the cost (spheres with numbers in the center) -->

<xsl:choose>

<xsl:when test="$card/bricks &gt; 0 and $card/gems = $card/bricks and $card/recruits = $card/bricks">

<div class="all"><xsl:value-of select="$card/bricks"/></div>

</xsl:when>

<xsl:when test="$card/bricks = 0 and $card/gems = 0 and $card/recruits = 0">

<div class="null">0</div>

</xsl:when>

<xsl:otherwise>

<xsl:if test="$card/recruits &gt; 0">

<div class="rek"><xsl:value-of select="$card/recruits"/></div>

</xsl:if>

<xsl:if test="$card/gems &gt; 0">

<div class="gemy"><xsl:value-of select="$card/gems"/></div>

</xsl:if>

<xsl:if test="$card/bricks &gt; 0">

<div class="tehla"><xsl:value-of select="$card/bricks"/></div>

</xsl:if>

</xsl:otherwise>

</xsl:choose>

<!-- name -->

<h5><xsl:value-of select="$card/name"/></h5>

<!-- card's image and its border (colored via CSS according to class) -->

<xsl:if test="$c_img = 'yes'">

<img src="img/concepts/{$card/picture}" width="80px" height="60px" alt="{$card/name}" >

<xsl:choose>

<xsl:when test="$card/picture">

<xsl:attribute name="src">img/concepts/<xsl:value-of select="$card/picture"/></xsl:attribute>

</xsl:when>

<xsl:otherwise>

<xsl:attribute name="src">img/cards/card_<xsl:value-of select="$card/id"/>.png</xsl:attribute>

<xsl:if test="$c_revealed or $c_new">

<xsl:attribute name="style">float: left</xsl:attribute>

</xsl:if>

</xsl:otherwise>

</xsl:choose>

</img>

<xsl:if test="$c_revealed or $c_new">

<div class="miniflags">

<xsl:if test="$c_new">

<img src="img/card/new_miniflag.png" width="12px" height="12px" alt="new card" title="New card" />

</xsl:if>

<xsl:if test="$c_revealed">

<img src="img/card/revealed_miniflag.png" width="12px" height="12px" alt="revealed" title="Revealed" />

</xsl:if>

</div>

<div class="clear_floats"></div>

</xsl:if>

</xsl:if>

<!-- keywords -->

<xsl:choose>

<xsl:when test="$card/picture">

<p><b><xsl:value-of select="$card/keywords"/></b></p>

</xsl:when>

<xsl:otherwise>

<xsl:variable name="descriptions" select="document('keywords.xml')/am:keywords" />

<p>

<xsl:for-each select="str:split($card/keywords, ',')">

<xsl:variable name="keyword_name" select="." />

<xsl:variable name="keyword" select="$descriptions/am:keyword[contains($keyword_name, am:name)]" />

<xsl:variable name="keyword_description">

<xsl:if test="$keyword/am:basic_gain &gt; 0 or $keyword/am:bonus_gain &gt; 0">

<xsl:text>Basic gain </xsl:text>

<xsl:value-of select="$keyword/am:basic_gain"/>

<xsl:text>, bonus gain </xsl:text>

<xsl:value-of select="$keyword/am:bonus_gain"/>

<xsl:if test="$keywords_count">

<xsl:text>, real gain when played </xsl:text>

<xsl:for-each select="$keywords_count/*">

<xsl:if test="name = $keyword_name">

<xsl:value-of select="$keyword/am:basic_gain + (count - 1) * $keyword/am:bonus_gain"/>

</xsl:if>

</xsl:for-each>

</xsl:if>

<xsl:text>, </xsl:text>

</xsl:if>

<xsl:value-of select="$keyword/am:happy:escription"/>

</xsl:variable>

<xsl:choose>

<xsl:when test="$c_insignias = 'yes'">

<img class="insignia" src="img/insignias/{am:file_name($keyword/am:name)}.png" width="12px" height="12px" alt="{$keyword_name}" title="{concat($keyword_name, ' - ', $keyword_description)}" />

</xsl:when>

<xsl:otherwise>

<b>

<xsl:attribute name="title"><xsl:value-of select="$keyword_description"/></xsl:attribute>

<xsl:value-of select="$keyword_name"/>

<xsl:text>.</xsl:text>

</b>

</xsl:otherwise>

</xsl:choose>

</xsl:for-each>

</p>

</xsl:otherwise>

</xsl:choose>

<!-- card effect -->

<div>

<xsl:choose>

<xsl:when test="$card/picture">

<xsl:value-of select="am:BBCode_parse($card/effect)" disable-output-escaping="yes" />

</xsl:when>

<xsl:otherwise>

<xsl:value-of select="am:cardeffect($card/effect)" disable-output-escaping="yes"/>

</xsl:otherwise>

</xsl:choose>

</div>

</div>

</xsl:variable>

<func:result select="exsl:node-set($cardstring)"/>

</func:function>

</xsl:stylesheet>


With the latest error log being:


[15-Feb-2012 19:04:41] PHP Warning:  XSLTProcessor::transformToXml() [<a href='xsltprocessor.transformtoxml'>xsltprocessor.transformtoxml</a>]: xmlXPathCompOpEval: function translate not found in /home/ansem/public_html/arcomage/utils.php on line 119

[15-Feb-2012 19:04:41] PHP Warning:  XSLTProcessor::transformToXml() [<a href='xsltprocessor.transformtoxml'>xsltprocessor.transformtoxml</a>]: Unregistered function in /home/ansem/public_html/arcomage/utils.php on line 119

[15-Feb-2012 19:04:41] PHP Warning:  XSLTProcessor::transformToXml() [<a href='xsltprocessor.transformtoxml'>xsltprocessor.transformtoxml</a>]: xmlXPathCompiledEval: 2 object left on the stack in /home/ansem/public_html/arcomage/utils.php on line 119

[15-Feb-2012 19:04:41] PHP Warning:  XSLTProcessor::transformToXml() [<a href='xsltprocessor.transformtoxml'>xsltprocessor.transformtoxml</a>]: runtime error: file /home/ansem/public_html/arcomage/templates/utils.xsl line 104 element variable in /home/ansem/public_html/arcomage/utils.php on line 119

[15-Feb-2012 19:04:41] PHP Warning:  XSLTProcessor::transformToXml() [<a href='xsltprocessor.transformtoxml'>xsltprocessor.transformtoxml</a>]: Evaluating variable date failed in /home/ansem/public_html/arcomage/utils.php on line 119

[15-Feb-2012 19:04:44] PHP Warning:  XSLTProcessor::transformToXml() [<a href='xsltprocessor.transformtoxml'>xsltprocessor.transformtoxml</a>]: xmlXPathCompOpEval: function translate not found in /home/ansem/public_html/arcomage/utils.php on line 119

[15-Feb-2012 19:04:44] PHP Warning:  XSLTProcessor::transformToXml() [<a href='xsltprocessor.transformtoxml'>xsltprocessor.transformtoxml</a>]: Unregistered function in /home/ansem/public_html/arcomage/utils.php on line 119

[15-Feb-2012 19:04:44] PHP Warning:  XSLTProcessor::transformToXml() [<a href='xsltprocessor.transformtoxml'>xsltprocessor.transformtoxml</a>]: xmlXPathCompiledEval: 2 object left on the stack in /home/ansem/public_html/arcomage/utils.php on line 119

[15-Feb-2012 19:04:44] PHP Warning:  XSLTProcessor::transformToXml() [<a href='xsltprocessor.transformtoxml'>xsltprocessor.transformtoxml</a>]: runtime error: file /home/ansem/public_html/arcomage/templates/utils.xsl line 152 element variable in /home/ansem/public_html/arcomage/utils.php on line 119

[15-Feb-2012 19:04:44] PHP Warning:  XSLTProcessor::transformToXml() [<a href='xsltprocessor.transformtoxml'>xsltprocessor.transformtoxml</a>]: Evaluating variable datetime2_fix failed in /home/ansem/public_html/arcomage/utils.php on line 119

[15-Feb-2012 19:04:47] PHP Warning:  XSLTProcessor::transformToXml() [<a href='xsltprocessor.transformtoxml'>xsltprocessor.transformtoxml</a>]: xmlXPathCompOpEval: function translate not found in /home/ansem/public_html/arcomage/utils.php on line 119

[15-Feb-2012 19:04:47] PHP Warning:  XSLTProcessor::transformToXml() [<a href='xsltprocessor.transformtoxml'>xsltprocessor.transformtoxml</a>]: Unregistered function in /home/ansem/public_html/arcomage/utils.php on line 119

[15-Feb-2012 19:04:47] PHP Warning:  XSLTProcessor::transformToXml() [<a href='xsltprocessor.transformtoxml'>xsltprocessor.transformtoxml</a>]: xmlXPathCompiledEval: 2 object left on the stack in /home/ansem/public_html/arcomage/utils.php on line 119

[15-Feb-2012 19:04:47] PHP Warning:  XSLTProcessor::transformToXml() [<a href='xsltprocessor.transformtoxml'>xsltprocessor.transformtoxml</a>]: runtime error: file /home/ansem/public_html/arcomage/templates/utils.xsl line 152 element variable in /home/ansem/public_html/arcomage/utils.php on line 119

[15-Feb-2012 19:04:47] PHP Warning:  XSLTProcessor::transformToXml() [<a href='xsltprocessor.transformtoxml'>xsltprocessor.transformtoxml</a>]: Evaluating variable datetime2_fix failed in /home/ansem/public_html/arcomage/utils.php on line 119

[15-Feb-2012 19:04:49] PHP Warning:  XSLTProcessor::transformToXml() [<a href='xsltprocessor.transformtoxml'>xsltprocessor.transformtoxml</a>]: xmlXPathCompOpEval: function translate not found in /home/ansem/public_html/arcomage/utils.php on line 119

[15-Feb-2012 19:04:49] PHP Warning:  XSLTProcessor::transformToXml() [<a href='xsltprocessor.transformtoxml'>xsltprocessor.transformtoxml</a>]: Unregistered function in /home/ansem/public_html/arcomage/utils.php on line 119

[15-Feb-2012 19:04:49] PHP Warning:  XSLTProcessor::transformToXml() [<a href='xsltprocessor.transformtoxml'>xsltprocessor.transformtoxml</a>]: xmlXPathCompiledEval: 2 object left on the stack in /home/ansem/public_html/arcomage/utils.php on line 119

[15-Feb-2012 19:04:49] PHP Warning:  XSLTProcessor::transformToXml() [<a href='xsltprocessor.transformtoxml'>xsltprocessor.transformtoxml</a>]: runtime error: file /home/ansem/public_html/arcomage/templates/utils.xsl line 152 element variable in /home/ansem/public_html/arcomage/utils.php on line 119

[15-Feb-2012 19:04:49] PHP Warning:  XSLTProcessor::transformToXml() [<a href='xsltprocessor.transformtoxml'>xsltprocessor.transformtoxml</a>]: Evaluating variable datetime2_fix failed in /home/ansem/public_html/arcomage/utils.php on line 119