xsl-list
[Top] [All Lists]

RE: XSL taking very long

2004-08-26 13:44:35
Ok, sorry about that, here is the category

<?xml version="1.0" encoding="UTF-8"?>
<Search>
<SearchResults>
<vform>
<item_id>BB55554</item_id><rvsn_id>1</rvsn_id><title_txt><![CDATA[RESOURCE 
NEWSLETTER]]></title_txt></vform>
<vform>
<item_id>BB55552</item_id><rvsn_id>7</rvsn_id><title_txt><![CDATA[MAILER]]></title_txt><Category>General
 Marketing</Category></vform>
<vform>
<item_id>BB5555CO</item_id><rvsn_id>0</rvsn_id><title_txt><![CDATA[INSTANT 
ISSUE PAC]]></title_txt></vform>
<vform>

The output I want is a table with

item_id | title_txt | category  // grouped by category

Should I use Keys instead?
Thanks,

Ashish D. Tengshe
IT System Analyst
Tengshe(_dot_)Ashish(_at_)Principal(_dot_)com


-----Original Message-----
From: Josh Canfield [mailto:joshcanfield(_at_)gmail(_dot_)com]
Sent: Thursday, August 26, 2004 2:14 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] XSL taking very long


The XML provided doesn't have a Category element...

You probably shouldn't be using //vform which translates to
/descendant-or-self::node()/child::vform and causes the entire node
tree to be searched for vform elements from the root to the deepest
leaf. Depending on your context you probably just need vform, or
perhaps /Search/SearchResults/vform.

Josh

On Thu, 26 Aug 2004 14:02:58 -0500, Tengshe, Ashish
<tengshe(_dot_)ashish(_at_)principal(_dot_)com> wrote:
This XSL transformation has been taking very long and after trying to 
minimize all the other inefficiencies, I'm left with the following code that 
I don't know how to minimize.

               <xsl:call-template name="process-categories">
                       <xsl:with-param name="cats" 
select="//vform[not(Category=preceding::vform/Category)]"/>
               </xsl:call-template>

               <xsl:template name="process-categories">
                       <xsl:param name="cats"/>
                       <xsl:for-each select="$cats">
                       <xsl:if test="Category != ''">
                       <TR>
                       <TD NOWRAP="NOWRAP" VALIGN="TOP" ALIGN="LEFT">Cat: 
<xsl:value-of select="Category"/></TD>
                       </TR>
                       </xsl:if>
                       </xsl:for-each>
               </xsl:template>

The XML is of the following format

       <?xml version="1.0" encoding="UTF-8"?>
       <Search>
       <SearchResults>
               <vform>
                       
<item_id>78987ghg98</item_id><rvsn_id>1</rvsn_id><title_txt><![CDATA[MY 
NEWSLETTER]]></title_txt></vform>
               <vform>
               ---
               ---
               ---
               100s of vform elements
               ---
               ---
       </SearchResults>
       </Search>

Let me know if you'd like the full XSL code.
Any ideas why it is taking so long (using Xalan) and can this output be 
achieved by other means?
I appreciate your help!

Ashish D. Tengshe
IT System Analyst
Principal Financial Group
Tengshe(_dot_)Ashish(_at_)Principal(_dot_)com

--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--



<Prev in Thread] Current Thread [Next in Thread>