Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 17th, 2008, 11:24 AM
Authorized User
 
Join Date: May 2008
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to anboss
Default memory leakage

i am hearing that xsl code has potential danger of giving rise to memory leakage. what exactly is this memory leakage. how to determine this problem. what gives rise to this problem

also is there any tool which gives the correct metric of how efficient my code is in terms of O(?)

 
Old July 17th, 2008, 12:13 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

The term "memory leakage" would imply a bug in your XSLT processor. Some XSLT processors might occasionally exhibit such bugs, but it's not a general feature or one that should cause you to lose sleep.

Perhaps you're not really concerned with memory leakage, but with high memory usage? It's certainly true that when processing large documents, XSLT processors can use correspondingly large amounts of memory. A figure of 5 times document size is typical for the better processors. Some processors such as Saxon have the ability to do certain limited transformations in a streaming mode where the whole document is not read into memory.

>is there any tool which gives the correct metric of how efficient my code is in terms of O(?)

If you mean a tool that does static anaylsis on your stylesheet, no. (I'm not sure it is in general possible, and it would certainly be processor-dependent). It's easy enough to measure it, however.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old July 17th, 2008, 02:34 PM
Authorized User
 
Join Date: May 2008
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to anboss
Default


you mean... however bad a xslt code is... if the xslt processor is very robust... performance will be good automaticaly... is it not?

 
Old July 17th, 2008, 02:50 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

>you mean... however bad a xslt code is... if the xslt processor is very robust... performance will be good automaticaly...

I don't mean anything of the kind. I don't see how you could possibly interpret my words that way.


Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old July 17th, 2008, 03:21 PM
Authorized User
 
Join Date: May 2008
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to anboss
Default

ok i am taking few lines from another post.

"
>if we pass parameters say some 8 parameters to a template

The answers to questions like this are likely to vary from one XSLT processor to another. I would recommend asking them on the support forum for the particular product you are interested in."

(http://p2p.wrox.com/topic.asp?TOPIC_ID=72684 is the link)

we had a transformation to do from one xml to another xml format. the resultant xml is huge as shown below. here to populate "transactionDetailList" we passed parameters to a template to populate this list.(we will populate this transactionDetailList twice, so in order to make the code look neat we a separate template to populate the transactionDetailList). the performance was not satisfactory. again we populated transactionDetailList in a straight forward way without using call to template. we noticed a better performance. (but though this way of populating is straightforward, the code goes lengthy). so this makes me to conclude that way...

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dp="http://www.datapower.com/extensions" xmlns:func="http://exslt.org/functions" xmlns:date="http://exslt.org/dates-and-times" xmlns:v002="http://www.company.com/schema/eih/LoggingCommonTypes/v001" xmlns:cihfn="http://www.cih.com/xslt/extensions" extension-element-prefixes="dp func cihfn">
    <xsl:output method="xml" indent="yes"/>
    <xsl:template match="/">
        <xsl:variable name="currMilli" select="dp:time-value()"/>
        <xsl:variable name="timeElapsed" select="dp:variable('var://service/time-elapsed')"/>
        <xsl:variable name="actualStartTime" select="number($currMilli - $timeElapsed)"/>
        <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://www.company.com/wsdl/eih/EnterpriseLogging/V1_0" xmlns:v002="http://www.company.com/schema/eih/LoggingCommonTypes/V001">
            <soapenv:Header/>
            <soapenv:Body>
                <v1:LogTransaction>
                    <v1:applicationDetail>
                        <v002:name>app01</v002:name>
                        <v002:role>intermediary</v002:role>
                        <v002:serverName>
                            <xsl:value-of select="concat(dp:variable('var://service/system/ident')/identification/device-name,':',dp:variable('var://service/domain-name'))"/>
                        </v002:serverName>
                        <v002:datacenter/>
                    </v1:applicationDetail>
                    <xsl:variable name="RequestHeader" select="dp:variable('var://context/cih/RequestHeader')"/>
                    <xsl:variable name="verbosityStatus" select="string(cihfn:getVerbosityStatus())"/>
                    <xsl:choose>
                        <xsl:when test="dp:variable('var://context/log/transactionStatus') = 'failure'">
                            <v1:transactionDetailList xmlns:v1="http://www.company.com/wsdl/eih/EnterpriseLogging/V1_0" xmlns:v002="http://www.company.com/schema/eih/LoggingCommonTypes/V001">
                                <v002:transactionName>
                                    <xsl:value-of select="dp:variable('var://context/cih/resource')"/>
                                </v002:transactionName>
                                <v002:correlation>
                                    <v002:traceID>
                                        <xsl:value-of select="$RequestHeader//*[local-name()='traceId']"/>
                                    </v002:traceID>
                                    <v002:createdTraceID>false</v002:createdTraceID>
                                    <v002:transactionID>
                                        <xsl:value-of select="concat(dp:variable('var://service/transaction-id'), ':',$RequestHeader//*[local-name()='traceId'])"/>
                                    </v002:transactionID>
                                    <v002:transactionLevel>main</v002:transactionLevel>
                                </v002:correlation>
                                <v002:systems>
                                    <v002:consumer>
                                        <xsl:value-of select="$RequestHeader//*[local-name()='component']"/>
                                    </v002:consumer>
                                    <v002:provider>
                                        <xsl:value-of select="dp:variable('var://context/cih/config')//application"/>
                                    </v002:provider>
                                </v002:systems>
                                <v002:transactionTimes>
                                    <v002:start>
                                        <xsl:value-of select="string(cihfn:getGMTtime($actualStartTime)) "/>
                                    </v002:start>
                                    <v002:end>
                                        <xsl:value-of select="string(cihfn:getGMTtime(number($actualStar tTime + $timeElapsed)))"/>
                                    </v002:end>
                                </v002:transactionTimes>
                                <v002:result>
                                    <v002:status>
                                    failure
                                </v002:status>
                                    <v002:errorReason>
                                        <xsl:value-of select=".//*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='Fault']/*[local-name()='detail']/*[local-name()='FaultDetail']/*[local-name()='listOfExceptions']/*[local-name()='Exception']/*[local-name()='detail']/*[local-name()='code']"/>
                                    </v002:errorReason>
                                    <v002:errorDescription>
                                        <xsl:value-of select=".//*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='Fault']/*[local-name()='detail']/*[local-name()='FaultDetail']/*[local-name()='listOfExceptions']/*[local-name()='Exception']/*[local-name()='detail']/*[local-name()='message']"/>
                                    </v002:errorDescription>
                                </v002:result>
                                <v002:miscData>
                                    <v002:channel>
                                        <xsl:value-of select="$RequestHeader//*[local-name()='channel']"/>
                                    </v002:channel>
                                    <v002:companyNumber/>
                                    <v002:userId>
                                        <xsl:value-of select="$RequestHeader//*[local-name()='userId']"/>
                                    </v002:userId>
                                    <v002:costCenter/>
                                    <v002:state/>
                                    <v002:triggerEvent/>
                                    <v002:additionalInfo/>
                                </v002:miscData>
                                <v002:protocol>
                                    <v002:message>
                                        <xsl:value-of select="dp:variable('var://context/log/targetMessageType')"/>
                                    </v002:message>
                                    <v002:transport>
                                        <xsl:value-of select="dp:variable('var://service/protocol')"/>
                                    </v002:transport>
                                </v002:protocol>
                                <v002:verbosityData>
                                    <xsl:choose>
                                        <xsl:when test="$verbosityStatus = 'true'">
                                            <v002:request>
                                                <xsl:value-of disable-output-escaping="yes" select="string('&lt;![CDATA[')"/>
                                                <xsl:copy-of select="dp:variable('var://context/INPUT')"/>
                                                <xsl:value-of disable-output-escaping="yes" select="string(']]&gt;')"/>
                                            </v002:request>
                                            <v002:response>
                                                <xsl:value-of disable-output-escaping="yes" select="string('&lt;![CDATA[')"/>
                                                <xsl:copy-of select="."/>
                                                <xsl:value-of disable-output-escaping="yes" select="string(']]&gt;')"/>
                                            </v002:response>
                                        </xsl:when>
                                        <xsl:otherwise>
                                            <v002:request>
                                                <xsl:value-of select="string-length(string(dp:variable('var://context/INPUT')))"/>
                                            </v002:request>
                                            <v002:response>
                                                <xsl:copy-of select="string-length(string(.))"/>
                                            </v002:response>
                                        </xsl:otherwise>
                                    </xsl:choose>
                                </v002:verbosityData>
                            </v1:transactionDetailList>
                        </xsl:when>
                        <xsl:otherwise>
                            <v1:transactionDetailList xmlns:v1="http://www.company.com/wsdl/eih/EnterpriseLogging/V1_0" xmlns:v002="http://www.company.com/schema/eih/LoggingCommonTypes/V001">
                                <v002:transactionName>
                                    <xsl:value-of select="dp:variable('var://context/cih/resource')"/>
                                </v002:transactionName>
                                <v002:correlation>
                                    <v002:traceID>
                                        <xsl:value-of select="$RequestHeader//*[local-name()='traceId']"/>
                                    </v002:traceID>
                                    <v002:createdTraceID>false</v002:createdTraceID>
                                    <v002:transactionID>
                                        <xsl:value-of select="concat(dp:variable('var://service/transaction-id'), ':',$RequestHeader//*[local-name()='traceId'])"/>
                                    </v002:transactionID>
                                    <v002:transactionLevel>child</v002:transactionLevel>
                                </v002:correlation>
                                <v002:systems>
                                    <v002:consumer>
                                        <xsl:value-of select="$RequestHeader//*[local-name()='component']"/>
                                    </v002:consumer>
                                    <v002:provider>
                                        <xsl:value-of select="dp:variable('var://context/cih/config')//application"/>
                                    </v002:provider>
                                </v002:systems>
                                <v002:transactionTimes>
                                    <v002:start>
                                        <xsl:value-of select="string(cihfn:getGMTtime(number($actualStar tTime + dp:variable('var://context/log/targetRequestTime'))))"/>
                                    </v002:start>
                                    <v002:end>
                                        <xsl:value-of select="string(cihfn:getGMTtime(number($actualStar tTime + dp:variable('var://service/time-response-complete'))))"/>
                                    </v002:end>
                                </v002:transactionTimes>
                                <v002:result>
                                    <v002:status>success</v002:status>
                                </v002:result>
                                <v002:miscData>
                                    <v002:channel>
                                        <xsl:value-of select="$RequestHeader//*[local-name()='channel']"/>
                                    </v002:channel>
                                    <v002:companyNumber/>
                                    <v002:userId>
                                        <xsl:value-of select="$RequestHeader//*[local-name()='userId']"/>
                                    </v002:userId>
                                    <v002:costCenter/>
                                    <v002:state/>
                                    <v002:triggerEvent/>
                                    <v002:additionalInfo/>
                                </v002:miscData>
                                <v002:protocol>
                                    <v002:message>
                                        <xsl:value-of select="dp:variable('var://context/log/targetMessageType')"/>
                                    </v002:message>
                                    <v002:transport>
                                        <xsl:value-of select="dp:variable('var://service/protocol')"/>
                                    </v002:transport>
                                </v002:protocol>
                                <v002:verbosityData>
                                    <xsl:choose>
                                        <xsl:when test="$verbosityStatus = 'true'">
                                            <v002:request>
                                                <xsl:value-of disable-output-escaping="yes" select="string('&lt;![CDATA[')"/>
                                                <xsl:copy-of select="dp:variable('var://context/log/targetRequest')"/>
                                                <xsl:value-of disable-output-escaping="yes" select="string(']]&gt;')"/>
                                            </v002:request>
                                            <v002:response>
                                                <xsl:value-of disable-output-escaping="yes" select="string('&lt;![CDATA[')"/>
                                                <xsl:copy-of select="dp:variable('var://context/INPUT')"/>
                                                <xsl:value-of disable-output-escaping="yes" select="string(']]&gt;')"/>
                                            </v002:response>
                                        </xsl:when>
                                        <xsl:otherwise>
                                            <v002:request>
                                                <xsl:value-of select="string-length(string(dp:variable('var://context/log/targetRequest')))"/>
                                            </v002:request>
                                            <v002:response>
                                                <xsl:copy-of select="string-length(string(dp:variable('var://context/INPUT')))"/>
                                            </v002:response>
                                        </xsl:otherwise>
                                    </xsl:choose>
                                </v002:verbosityData>
                            </v1:transactionDetailList>
                            <v1:transactionDetailList xmlns:v1="http://www.company.com/wsdl/eih/EnterpriseLogging/V1_0" xmlns:v002="http://www.company.com/schema/eih/LoggingCommonTypes/V001">
                                <v002:transactionName>
                                    <xsl:value-of select="dp:variable('var://context/cih/resource')"/>
                                </v002:transactionName>
                                <v002:correlation>
                                    <v002:traceID>
                                        <xsl:value-of select="$RequestHeader//*[local-name()='traceId']"/>
                                    </v002:traceID>
                                    <v002:createdTraceID>false</v002:createdTraceID>
                                    <v002:transactionID>
                                        <xsl:value-of select="concat(dp:variable('var://service/transaction-id'), ':',$RequestHeader//*[local-name()='traceId'])"/>
                                    </v002:transactionID>
                                    <v002:transactionLevel>main</v002:transactionLevel>
                                </v002:correlation>
                                <v002:systems>
                                    <v002:consumer>
                                        <xsl:value-of select="$RequestHeader//*[local-name()='component']"/>
                                    </v002:consumer>
                                    <v002:provider>
                                        <xsl:value-of select="dp:variable('var://context/cih/config')//application"/>
                                    </v002:provider>
                                </v002:systems>
                                <v002:transactionTimes>
                                    <v002:start>
                                        <xsl:value-of select="string(cihfn:getGMTtime($actualStartTime)) "/>
                                    </v002:start>
                                    <v002:end>
                                        <xsl:value-of select="string(cihfn:getGMTtime(number($actualStar tTime + $timeElapsed)))"/>
                                    </v002:end>
                                </v002:transactionTimes>
                                <v002:result>
                                    <v002:status>success</v002:status>
                                </v002:result>
                                <v002:miscData>
                                    <v002:channel>
                                        <xsl:value-of select="$RequestHeader//*[local-name()='channel']"/>
                                    </v002:channel>
                                    <v002:companyNumber/>
                                    <v002:userId>
                                        <xsl:value-of select="$RequestHeader//*[local-name()='userId']"/>
                                    </v002:userId>
                                    <v002:costCenter/>
                                    <v002:state/>
                                    <v002:triggerEvent/>
                                    <v002:additionalInfo/>
                                </v002:miscData>
                                <v002:protocol>
                                    <v002:message>
                                        <xsl:value-of select="dp:variable('var://context/log/clientMessageType')"/>
                                    </v002:message>
                                    <v002:transport>
                                        <xsl:value-of select="dp:variable('var://service/protocol')"/>
                                    </v002:transport>
                                </v002:protocol>
                                <v002:verbosityData>
                                    <xsl:choose>
                                        <xsl:when test="$verbosityStatus = '
 
Old July 17th, 2008, 04:20 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

>the performance was not satisfactory. again we populated transactionDetailList in a straight forward way without using call to template. we noticed a better performance.

Interesting information. But if you said what XSLT processor you were using, then it might even be useful information. Without knowing, it's completely useless, since the chances are a different XSLT processor will exhibit quite different behaviour.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old July 17th, 2008, 05:09 PM
Authorized User
 
Join Date: May 2008
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to anboss
Default

i am working in an SOA appliance - datapower. and it uses a customized xslt processor.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Memory akkad C# 2005 3 January 10th, 2007 04:46 AM
Memory akkad C# 0 January 9th, 2007 10:01 AM
Out of Memory ocabrera70 Classic ASP Components 0 February 15th, 2006 09:08 PM
Out of memory : simplyAns All Other Wrox Books 0 November 9th, 2004 08:56 AM
Memory linguva Access 2 December 19th, 2003 07:22 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.