Hi Laurence,

Thanks for pointing this out. I couldn't get this to work, however. I appended
the snippet you suggested at the end of my rules file, but there was no
noticable change. Even when i made the query less specific by removing the
"/@src[not(contains(., '@@'))]" from the selector, there was nog change in
image src urls.

I experimented with the example at
http://codespeak.net/svn/z3/xdv/trunk/lib/xdv/tests/copy-xsl/rules.xml. I can
indeed replace some characters in the html head title in this way
(match="html/head/title/text()"). I also succeeded in appending text there
(using the <xsl:copy /> statement). However, when i change the selector to
match all h2's in the page (match="//h2/text()), it doesn't work.
match="//title/text()" does work, however.

Do you have any other ideas as to what i'm doing wrong?

Kees

PS version info:
collective.xdv-1.0rc11
xdv-0.4b2

On 10/18/2010 02:16 PM, Laurence Rowe wrote:
> 
> 
> 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
_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers

Reply via email to