Forum Moderators: coopster

Message Too Old, No Replies

return string from xslt php function in

php 5 xslt functions

         

eltreno

3:30 pm on Sep 7, 2006 (gmt 0)

10+ Year Member



Hi

I have a blob of xml stored in my database and it contains <para> elements(which i want that para text to have substitutions made on it not rest of xml content)

so in my xslt, my 'para' template does a call to a php function like so

<xsl:template match="paragraph">
<xsl:variable name="contents"><xsl:value-of select="."/></xsl:variable>
<paragraph><xsl:value-of select="php:function(linkParaText, string($contents))"/></paragraph>
</xsl:template>

my php function then returns a string of content then after substitution has been made

My delima:
The substitution I do is linking certain word to text
Making: some text
Into: <a href="blah">some text</a>
for example..

but when php return the string, xslt treates it as a string and converts < into &lt; etc

and I can't then print that to scrren as the <a href shows as text instead of linkinfg the text like normal html

Anybody know how I can convert this back to dom rather then string in the xslt or how i should do the return any different.

my php finction is like so

function linkParaText($paraXML){

global $myArray;

$newParaXML = str_ireplace(array_keys($myArray), array_values($myArray), $paraXML);

return $newParaXML;
}

Thanks
Trent

eelixduppy

1:53 am on Sep 14, 2006 (gmt 0)



If I understand your problem correctly, it seems that you want to use html_entity_decode [us3.php.net] before echoing the link to the browser.

Good luck!