cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ard Schrijvers" <a.schrijv...@hippo.nl>
Subject RE: i18nTransformer problems with static pages
Date Tue, 05 Dec 2006 11:14:16 GMT


> You should add an extra stylesheet that removes superfluous namespace 
> attributes. This is what I've done:

I used to use this strategy as well, though recently I replaced this xsl transformer with
a custom StripNameSpacesTransformer (about just 10 lines), which outperforms the slow xsl
transformation a factor 30 for small xml docs, over hundreds of times for bigger xml docs.
I am not sure if it is already available in cocoon in some transformer. 

If somebody is interested in the code, I can attach it,

Regards Ard

> 
>     <xsl:template match="*">
>        <!-- remove element prefix (if any) -->
>        <xsl:element name="{local-name()}">
>          <!-- process attributes -->
>          <xsl:for-each select="@*">
>            <!-- remove attribute prefix (if any) -->
>            <xsl:attribute name="{local-name()}">
>              <xsl:value-of select="."/>
>            </xsl:attribute>
>          </xsl:for-each>
>          <xsl:apply-templates/>
>        </xsl:element>
>    </xsl:template>
> 
> Add a generic catchall template or you end up with nothing:
> 
>     <!-- ========================================= -->
>     <!-- generic catchall template                 -->
>     <!-- ========================================= -->
>     <xsl:template match="text()">
>        <xsl:copy>
>           <xsl:apply-templates select="text()"/>
>        </xsl:copy>
>     </xsl:template>
> 
> 
> HTH
> 
> Bye, Helma
> 
> 

Mime
View raw message