importStylesheet doen't work

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I'm using PHP 5.0.4 on Windows 2000 with IIS.  Try as I might I can't get
an XSLT transformation to work.  Here's my code, all I get when I run
collection.php is:

"loaded collection xml ok
loaded collection xsl ok
couldn't import the stylesheet"

Is is possible to get a detailed error returned from the XSLTProcessor()
class?  I know the xml and xsl are ok as I can run the transform using ASP.

Thanks in advance,

Paul



collection.xml:

<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>



collection.xsl:

<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>



collection.php:

<?php
$xml_doc=new DomDocument;
if (!$xml_doc->load("collection.xml")) {
echo "couldn't load collection xml";
}
else {
echo "loaded collection xml ok<br>";
}

$xsl=new DomDocument;
if (!$xsl->load("collection.xsl")) {
echo "couldn't load collection xsl";
}
else {
echo "loaded collection xsl ok<br>";
}

$xp=new XSLTProcessor();
if (!$xp->importStylesheet($xsl)) {
echo "couldn't import the stylesheet<br>";
exit;
}
else {
echo "imported the stylesheet into the processor ok<br>";
}
echo $xp->transformToDoc($xml_doc);
?>


**************************************************************************

e-solutions for marketing
http://www.elateral.com/uk

Elateral Limited, Crosby Way, Farnham, GU9 7XX, UK
Tel. +44 (0)1252 740740
Fax. +44 (0)1252 740741
***********************************************************************
This e-mail is confidential and may be privileged.  It may be read,
copied and used only by the intended recipient.  If you have received
it in error please contact the sender immediately by return e-mail or
by telephone. Please then delete the e-mail and do not disclose its
contents to any person.  We believe, but do not warrant, that this
e-mail and any attachments are virus free.  You should take full
responsibility for virus checking.  Elateral reserves the right to
monitor all e-mail communications through its internal and external
networks.  The opinions or ideas expressed above belong to their
author and do not necessarily reflect the views of the Elateral Group.
***********************************************************************

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux