Kees Hink wrote:
> 
> I'm trying to do something with collective.xdv that just might be too
> ambitious. I'd like some advice.
> 
> I'm trying so replace all image source urls from a specific element with
> urls
> that point to a scaled version of the image. So ' some-image '
> should be ' some-image/@@images/image/thumb '.
> 
> Use case: I'm taking entire Collage-items out of the Collage and putting
> them
> in another layout. (I don't loop over individual img elements.) This is
> actually a problem with Collage, but Collage "fixes" it by specifying
> "width:100%" for images inside it. The downside of this is that content
> editors
> _will_ insert 2Mb images which the user will have to download (only to be
> rendered as 180x180). I could use this "fix" for the theme as well, but
> (while
> acceptable for the Plone back-end) having such large images on a public
> site is
> just immoral.
> 
> I read [1] that you can specify search-and-replace in xslt, but how could
> one
> get this to work in collective.xdv?
> 
> (We use various image sizes in the site, so setting an alias for /view
> which
> redirects to the scaled size will have side effects.)
> 

I would do something like:

<xsl:template match="img/@src[not(contains(.,
'@@'))]"><xsl:copy/>/@@/images/image/thumb</xsl:template>

For more complex string operations you need the exslt string namespace. See
http://plone.293351.n2.nabble.com/XDV-guru-how-drop-a-substring-td5608087.html

Laurence
-- 
View this message in context: 
http://plone.293351.n2.nabble.com/complex-XSLT-in-collective-xdv-search-and-replace-in-HTML-tp5646426p5646795.html
Sent from the Product Developers mailing list archive at Nabble.com.
_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers

Reply via email to