Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XSLT Add target="_blank" to a URL

I've created an XSLT file that runs through a SharePoint list to generate a table of resources. One part of it creates a link that goes off site. I'm wanting to have it open in a new window using target="_blank", but I'm unsure of how to do this in the XSLT.

Here's the portion that creates the link:

<xsl:element name="a">
    <xsl:attribute name="href">
        <xsl:value-of select="Website"/>
    </xsl:attribute>
    <xsl:text>Visit Website</xsl:text>
</xsl:element>

Can anyone shed some light on this for me? I'm fairly new to working with XSLTs.

like image 488
snowBlind Avatar asked Sep 30 '11 17:09

snowBlind


1 Answers

Will it work ?

<xsl:element name="a">
<xsl:attribute name="href">
    <xsl:value-of select="Website"/>
</xsl:attribute>
   <xsl:attribute name="target">_blank</xsl:attribute>
<xsl:text>Visit Website</xsl:text>
</xsl:element>
like image 161
a1ex07 Avatar answered Sep 20 '22 13:09

a1ex07