XSLT fails to load huge XML doc after matching certain elements
- by krisvandenbergh
I'm trying to match certain elements using XSLT. My input document is very large and the source XML fails to load after processing the following code (consider especially the first line).
<xsl:template match="XMI/XMI.content/Model_Management.Model/Foundation.Core.Namespace.ownedElement/Model_Management.Package/Foundation.Core.Namespace.ownedElement">
<rdf:RDF>
<rdf:Description rdf:about="">
<xsl:for-each select="Foundation.Core.Class">
<xsl:for-each select="Foundation.Core.ModelElement.name">
<owl:Class rdf:ID="@Foundation.Core.ModelElement.name" />
</xsl:for-each>
</xsl:for-each>
</rdf:Description>
</rdf:RDF>
</xsl:template>
Apparently the XSLT fails to load after "Model_Management.Model". The PHP code is as follows:
if ($xml->loadXML($source_xml) == false) {
die('Failed to load source XML: ' . $http_file);
}
It then fails to perform loadXML and immediately dies. I think there are two options now.
1) I should set a maximum executing time. Frankly, I don't know how that I do this for the built-in PHP 5 XSLT processor.
2) Think about another way to match.
What would be the best way to deal with this?
The input document can be found at http://krisvandenbergh.be/uml_pricing.xml
Any help would be appreciated! Thanks.