XSLT fails to load huge XML doc after matching certain elements
Posted
by krisvandenbergh
on Stack Overflow
See other posts from Stack Overflow
or by krisvandenbergh
Published on 2010-05-01T19:07:13Z
Indexed on
2010/05/01
19:37 UTC
Read the original article
Hit count: 327
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.
© Stack Overflow or respective owner