Problem with XSLT importStyleSheet
Timothy Murphy
tim at birdsnest.maths.tcd.ie
Wed Mar 28 20:55:43 UTC 2007
<posted & mailed>
Tijnema ! wrote:
>> I've been trying to use PHP/XSLT on my desktop,
>> running Fedora-6 Linux (with all current updates).
>> The function importStyleSheet() seems to cause
>> a Segmentation Violation,
Thanks for your response.
> I have no problem with testing, i'm running home-made linux system
> with PHP5 & PHP6 (Apache). Also running PHP5 under windows (Apache).
>
> Just need an example XSL/XML file to test:) Could you send one?
> (Off-list maybe because attachments are giving trouble sometimes on
> this list)
Actually, the first example I gave comes from
what I assume is the "official" PHP manual
at <http://ie.php.net/xsl%22%3E>.
There are 3 files, collection.xml, collection.xsl
and the actual PHP script, Example 2526 (which I call ex2526.php), from
http://ie.php.net/manual/en/function.xsl-xsltprocessor-transform-to-xml.php
All 3 files are very short, so I give them here:
--------------------------------
<collection>
<cd>
<title>Fight for your mind</title>
<artist>Ben Harper</artist>
<year>1995</year>
</cd>
<cd>
<title>Electric Ladyland</title>
<artist>Jimi Hendrix</artist>
<year>1997</year>
</cd>
</collection>
--------------------------------
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="owner" select=""Nicolas Eliaszewicz'"/>
<xsl:output method="html" encoding="iso-8859-1" indent="no"/>
<xsl:template match="collection">
Hey! Welcome to <xsl:value-of select="$owner"/>'s sweet CD collection!
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="cd">
<h1><xsl:value-of select="title"/></h1>
<h2>by <xsl:value-of select="artist"/> - <xsl:value-of
select="year"/></h2>
<hr />
</xsl:template>
</xsl:stylesheet>
--------------------------------
<?php
// Load the XML source
$xml = new DOMDocument;
$xml->load('collection.xml');
$xsl = new DOMDocument;
$xsl->load('collection.xsl');
// Configure the transformer
$proc = new XSLTProcessor;
$proc->importStyleSheet($xsl); // attach the xsl rules
echo $proc->transformToXML($xml);
?>
--------------------------------
Now I get
[root at alfred Test]# php ex2526.php
Segmentation fault
I tried a few other examples,
but all those with importStyleSheet() in them
caused the same Segmentation fault.
--
Timothy Murphy
e-mail (<80k only): tim /at/ birdsnest.maths.tcd.ie
tel: +353-86-2336090, +353-1-2842366
s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland
More information about the fedora-list
mailing list