cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From leon tian <tianyr2...@yahoo.co.uk>
Subject Re: apply css?
Date Tue, 18 May 2004 01:33:33 GMT
Hi, i tried to using xsl:choose to link the img but the first 'when' doesn't work. Could you
spot the error for me? Thanks.
 
<xsl:template match="img/@src">
<xsl:variable name="link" select="." />
 <xsl:attribute name="src">
  <xsl:choose>
   <xsl:when test="starts-with($link ,'http')">
    <xsl:value-of select="."/>
   </xsl:when>
   <xsl:otherwise>
    <xsl:value-of select="concat($remoteserver, .)"/>
   </xsl:otherwise>
  </xsl:choose>
   </xsl:attribute>
</xsl:template>

Joerg Heinicke <joerg.heinicke@gmx.de> wrote:
On 18.05.2004 01:39, leon tian wrote:

> Hi, thanks for such detailed reply! I got it with 1 more question.
> Some remote pages reference their resources to the remote server like
> href="/css.css", the others using full url like
> href="http://www.remote.com/css.css". I'm thinking using your method
> 1 plus 'xsl:choose' to test the first four letters of 'href'
> (==http?) and link it to the correct url. But I don't know how to
> test the first four letters. Could you tell me how although it is
> more likely a xsl question.

xsl: starts-with(whatToTest, 'http')

There is also a linkrewriter block in Cocoon that might do this job in a 
more sophisticated way:
http://wiki.cocoondev.org/Wiki.jsp?page=BlockDescriptions. Maybe you get 
it to work.

Joerg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org

		
---------------------------------
  Yahoo! Messenger - Communicate instantly..."Ping" your friends today! Download Messenger
Now
Mime
View raw message