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.
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>
It's actually much easier than this: you don't need these xsl:element and xsl:attribute instructions at all. Just do
<a href="{Website}" target="_blank">Visit Website</a>
XSLT can be verbose, but it doesn't have to be!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.