RE: [xml] XSLTPROC is slow along with XSLT
- From: David Neary <David phenix fr>
- To: 'Vikrant Rathore' <vikrant linmark com>, xml gnome org
- Subject: RE: [xml] XSLTPROC is slow along with XSLT
- Date: Mon, 16 Feb 2004 12:37:10 +0100
Hi Vikrant,
From: Vikrant Rathore
i have written an XSL file an also developed a small
application to convert
XML to XSLT. There has been real performance issue with XSLT.
Your XSL is severely broken. Let me try to explain why...
<xsl:stylesheet version='1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform' >
<xsl:output method="text"/>
<xsl:for-each select="//item">
This traverses the whole tree
<xsl:text>D</xsl:text>
<xsl:value-of select="//job_id"/>
So does this
<snip>
so do the rest of these //s
</xsl:for-each>
So what you're getting is "Search the entire document for nodes called
"data", and for each one we find, search the entire document for elements
called "job_id", give me the text value of the first one, etc..."
This is extremely inefficient, and is also probably not what you want.
Assuming that your document looks something like this:
<action_calendar_data_exchange>
<item>
<job_id>12</job_id>
...
</item>
<item>
...
...
</item>
</action_calendar_data_exchange>
try changing your stylesheet to
<xsl:for-each select="item">
<xsl:value-of select="job_id"/>
<xsl:value-of select="customer_code"/>
...
</xsl:for-each>
Or at least changing the //s to .//s if there really is a need to search the
whole subtree. Adding the . means you're starting your search from the
currently selected node, and not from the root.
Regards,
Dave.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]