cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robin Green" <gree...@hotmail.com>
Subject Re: following-sibling performance
Date Thu, 21 Dec 2000 14:38:09 GMT
Riku Voipio <riku.voipio@tietoenator.com> wrote:
>lets say I have (the realtags are somewhat more complex, this a simplified 
>case):
>
><data>
>	<e><id>1</id><value>123</value></e>
>	<e><id>2</id><value>123</value></e>
>	<e><id>3</id><value>123</value></e>
>	<e><id>4</id><value>546</value></e>
>	<e><id>5</id><value>546</value></e>
>	<e><id>6</id><value>546</value></e>
></data>
>
>And I want
>
><table>
>	<tr><td>1-3</td><td>123</td></tr>
>	<tr><td>4-6</td><td>546</td></tr>
></table>
>
>I thought i solved it easily (at least the logic):
>
><xsl:template match="data">
><![CDATA[<table><tr><td>]]>
>     <xsl:value-of select="e[position()=1]/id"/> -
>     <xsl:for-each select="e">
>       <xsl:variable name="next-e" 
>select="following-sibling::e[position()=1]"/>
>         <xsl:if test="value!=$next-e/value">
>           <xsl:value-of select="id"/><![CDATA[</td><td>]]>
>           <xsl:value-of select="value"/><![CDATA[</td></tr><tr><td>]]>
>           <xsl:value-of select="$next-e/id"/> -
>         </xsl:if>
>     </xsl:for-each>
>     <xsl:value-of select="e[last()]/id"/> , <xsl:value-of 
>select="e[last()]/value"/>
>	<![CDATA[</td></tr></table>]]>
></xsl:template>
>
>    Now there is two problems a <data>
>
>a) this is insanely slow! processing with 500 <e> :s, takes 10 sec,
>   and that is a medium case! seems like the following-sibling is processed
>    rather slowly? Is there a alternative way?ould this be easily done with 
>xsp?

Not necessarily easily, but it will definitely work, and will definitely be 
much faster.

>b) <!|CDDAT[]]> tags are escaped - yep, I read the Faq - but at the moment
>    I didn't find any other ways...

Then you'll have to use XSP.



_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


Mime
View raw message