Developer forum

Forum » Templates » Link i xslt

Reply
Hej,

Jeg er ret grøn i xslt templates, så spørgsmål kan nok godt lyde lidt newbie :)

Jeg har følgende attributer på min template, og vil gerne lave et link med attributterne.. 

Hvordan gør jeg det.. 

 <xsl:attribute name="title">
<xsl:value-of select="EventInspirationTitle" disable-output-escaping="yes"/>. <xsl:value-of select="EventInspirationStartDate" disable-output-escaping="yes"/> kl. <xsl:value-of select="EventInspirationStartDate.ShortTime" disable-output-escaping="yes"/>
</xsl:attribute>
 
<xsl:attribute name="href">
<xsl:text></xsl:text>/Kalender.aspx?edt=<xsl:value-of select="EventInspirationEventDatTimeID" disable-output-escaping="yes"/>
</xsl:attribute>
 
<xsl:attribute name="src">
<xsl:text></xsl:text>files/system/arrangementer/kvadratiskformat/<xsl:value-of select="EventInspirationImage45x45" disable-output-escaping="yes"/>
        </xsl:attribute>
 
<xsl:attribute name="alt">
<xsl:value-of select="EventInspirationTitle" disable-output-escaping="yes"/>. <xsl:value-of select="EventInspirationStartDate" disable-output-escaping="yes"/> kl. <xsl:value-of select="EventInspirationStartDate.ShortTime" disable-output-escaping="yes"/>
</xsl:attribute>
-->    
 
<a href=""><img src="" alt="" title="" border="0"/></a>

Replies

 
Reply
Hi Jens

There are 2 ways of generating the structure you're looking for.

Example 1:
<a href="{concat('/Kalender.aspx?edt=', EventInspirationEventDatTimeID)}">
   <img src="{concat('files/system/arrangementer/kvadratiskformat/', EventInspirationImage45x45)}" alt="{concat(EventInspirationTitle, '. ', EventInspirationStartDate, ' kl. ', EventInspirationStartDate.ShortTime)}" title="{concat(EventInspirationTitle, '. ', EventInspirationStartDate, ' kl. ', EventInspirationStartDate.ShortTime)}" border="0"/>
  </a>

Example 2:  
  <a>
   <xsl:attribute name="href">
    <xsl:value-of select="concat('/Kalender.aspx?edt=', EventInspirationEventDatTimeID)" />
   </xsl:attribute>
   <img>
    <xsl:attribute name="src">
     <xsl:value-of select="concat('files/system/arrangementer/kvadratiskformat/', EventInspirationImage45x45)" />
    </xsl:attribute>
    <xsl:attribute name="alt">
     <xsl:value-of select="concat(EventInspirationTitle, '. ', EventInspirationStartDate, ' kl. ', EventInspirationStartDate.ShortTime)" />
    </xsl:attribute>
    <xsl:attribute name="title">
     <xsl:value-of select="concat(EventInspirationTitle, '. ', EventInspirationStartDate, ' kl. ', EventInspirationStartDate.ShortTime)" />
    </xsl:attribute>
    <xsl:attribute name="border">
     <xsl:text>0</xsl:text>
    </xsl:attribute>
   </img>
  </a>

They're both using the concat() function to join text and data ...

// Dammark

 

You must be logged in to post in the forum