Issue with XSLT Processing on PHP
- by monksy
I'm getting a few errors from XSLTProcessor:
XSLTProcessor::transformToDoc() [<a href='function.XSLTProcessor-transformToDoc'>function.XSLTProcessor-transformToDoc</a>]: Invalid or inclomplete context
XSLTProcessor::transformToDoc() [<a href='function.XSLTProcessor-transformToDoc'>function.XSLTProcessor-transformToDoc</a>]:
XSLTProcessor::transformToDoc() [<a href='function.XSLTProcessor-transformToDoc'>function.XSLTProcessor-transformToDoc</a>]: xsltValueOf: text copy failed in
Which is parsing this XSLT Line:
<xsl:apply-templates select="page/sections/section" mode="subset"/>
The section is:
<xsl:template match="page/sections/section" mode="subset">
<a href="#{shorttitle}">
<xsl:value-of select="title"/>
</a>
<xsl:if test="position() != last()"> | </xsl:if>
</xsl:template>
The XML that the section is parsing is:
<shorttitle>About</shorttitle>
<title>#~ About</title>
The PHP XSLT Code is:
$xslt = new XSLTProcessor();
$XSL = new DOMDocument();
$XSL->load( $xsltFile, LIBXML_NOCDATA);
$xslt->importStylesheet( $XSL );
print $xslt->transformToXML( $XML );
My suspicion about the the errors is due to content. I'm not getting these errors with Firefox's XSLT rendering, nor am I getting an invalid XML document on the backend.I'm not getting errors on the load, its just on the transformToXML function.
Does anyone have a clue on how to solve this?
This is with PHP5.