Re: [xsl] speed of loading

Subject: Re: [xsl] speed of loading
From: Joerg Heinicke <joerg.heinicke@xxxxxx>
Date: Fri, 31 May 2002 11:35:51 +0200
Using keys is "always" very good and should descrease running times. But it seems you are often using preceding-axis. You have restricted it with "position()=1" (can be shortened to "1"), but maybe the processor isn't optimized for it. As far as I can see form your XML the preceding-sibling-axis is the better choice, at least with your <Q>-elements. They all have the same parent <Quenstions>. So replace preceding::Q with preceding-sibling::Q.

Hope this helps a bit,

Joerg

Rosa Cheng wrote:
Thanx for you reply. In fact the XML is 22K and XSL is 32K. In the XSL I don't use '//' at all. Though I use a few for-each loops but to decrease searching time thru too many nodes, I usually use keys with extra Boolean tests, eg.
<xsl:for-each select="key('groupNm',@GroupName)[ not(preceding::Q[position()=1]/@QuestionCollection) or @QuestionCollection!=preceding::Q[position()=1]/@QuestionCollection and @GroupName!=preceding::Q[position()=1]/@GroupName]">...</xsl:for-each>
in fact this was only an experiment trying to restrict the nodes it processes (in an attempt to "optimise" my XSL), I used to have
<xsl:for-each select=" key('groupNm',@GroupName)">...</xsl:for-each>

However, my XML has a lot of attributes within each node... maybe that has an impact... here is some of the XML...

<Questions QuoteId="102" Action="quoteValidation.asp" PageName="Quote" XSLstylesheet="questions.xsl" ReadOnlyXSLstylesheet="readonlyquestions.xsl" TodaysDate="24/5/2002" PreQuestionText="<div class='divNote'>some more text goes here." PreQuestionClass="bodycopy" PostQuestionText="" PostQuestionClass="bodycopy" HelpImghelp.gif" HelpButtonToolTip="Help" HelpUrlhelp.asp?id=" CSSfile="style.css" CSSbodyfile="../css/" SessionId="Test">
<Q QuestionSetId="15" Visibility="Show" QuestionSetSequence="2" QuestionID="125" AnswerTag="insured_property_postcode" QuestionText="What is the postcode of the property to be insured?" ToolTip="Postcode" OnChange="f_changeMainList('property_postcode')" QuestionStyle="getquotebody" AnswerFieldStyle="getquoteanswer" AnswerFieldWidth="4" AnswerFieldMaxChars="4" SequenceNumber="1" GroupName=" Property Details" GroupStyle="getquoteheader" AnswerValue="2035" QuestionTypeName="Text" AnswerTypeName="Textbox" /> <Q QuestionSetId="15" Visibility="Show" QuestionSetSequence="2" QuestionID="126" AnswerTag="insured_property_suburb" QuestionText="In which suburb is the property?" ToolTip="Suburb" QuestionStyle="getquotebody1" AnswerFieldStyle="getquoteanswer1" SequenceNumber="2" GroupName="Property Details" GroupStyle="getquoteheader" DefaultValue="0" VeryLongOptionList="1" AnswerValue="488" AnswerDescription="MAROUBRA" QuestionTypeName="Text" AnswerTypeName="Combobox">
<QO OptionId="488" OptionDesc="MAROUBRA" OptionValue="488" /> <QO OptionId="489" OptionDesc="MAROUBRA JUNCTION" OptionValue="489" /> <QO OptionId="490" OptionDesc="MAROUBRA SOUTH" OptionValue="490" /> <QO OptionId="491" OptionDesc="PAGEWOOD" OptionValue="491" /> </Q>
</Questions>


I just read some thing about XSLTemplate and XSLProcessor, not sure whether they will help, ie by caching the XSL etc.

-----Original Message-----
From: Joerg Heinicke [mailto:joerg.heinicke@xxxxxx] Sent: Friday, 31 May 2002 4:43 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] speed of loading


Rosa Cheng wrote:

Can anyone please tell me why it takes a while for a transformed XML to load on the IE6 browser? (the browser seems to pause and then displays the HTML) At first I transformed the XML using ASP on the server-side, and then I tried to display the XML with a reference to XSL in the XML file, the pause was still there. Even though the loading took something like 4 seconds which may not sound very slow, but I was just wondering whether this time can be shortened and how to do that.

Thanx in advance! :)

Rosa


Hello Rosa,

without any code we can only guess. Normally MSXML is really fast, so there shouldn't be no 4s-pause. So there remain two questions: How big are the files (XML + XSLT)? And how optimized is the transformation? Maybe you can post parts of the code. The first suggestion of optimizing is always: replace '//' with more explicit XPath-expressions. Maybe it's an approach for optimization in your stylesheet too.

Joerg


--

System Development
VIRBUS AG
Fon  +49(0)341-979-7419
Fax  +49(0)341-979-7409
joerg.heinicke@xxxxxxxxx
www.virbus.de


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread