Error in XSLTP processor :: importStyleSheet ()

$xslt->importStyleSheet();

I got a crash Internal Server Error

on my screen. But it works when I replace position()=1

with false

in design.xsl

.

  • PHP version 5.3.29
  • XML support active
  • XML naming support
  • libxml2 Version 2.9.1
  • XSL included
  • libxslt Version 1.1.14
  • libxslt compiled to libxml version 2.6.19

testxslt.php

$xslt = new xsltProcessor;
$xslt->importStyleSheet(DomDocument::load('design.xsl'));
print $xslt->transformToXML(DomDocument::load('data.xml'));

      

data.xml

<?xml version="1.0" encoding="UTF-8"?>
<datalist>
    <data><title>title 1</title></data>
    <data><title>title 2</title></data>
    <data><title>title 3</title></data>
    <data><title>title 4</title></data>
</datalist>

      

design.xsl

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:template match="/datalist">
        <ul>
        <xsl:for-each select="data">
            <xsl:if test="position()=1">
                <li>top of entrylist</li>
            </xsl:if>
            <li><xsl:value-of select="title" /></li>
        </xsl:for-each>
        </ul>       
    </xsl:template>
</xsl:stylesheet>

      

Any advice? Thank.

+3


source to share





All Articles