Share via


Formatting Team Foundation Server Notifications

Use XSL to format event notifications. This transforms the event XML to the formatted notification.

To use XSL formatting, create an .xsl file in the D:\Program Files\Microsoft Visual Studio 2005 Team Foundation Server\Web Services\Services\v1.0\Transforms directory on the application tier. To use template formatting, create a .template file in the same directory. If both files are already in that directory for a given event type, use the template file.

XSL Example

The following is an example of an XSL transform.

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <!-- Normal file content -->
    <xsl:template match="/">
        <head>
        <title>Visual Studio Checkin Notification</title>
        </head>
        <body>
        <h1>Visual Studio Notification</h1>

        <p>One or more object was committed to the version control repository. Additional
            information is available by selecting one of the links below.</p>
        <h2>Changeset(s)</h2>
        <hr/>
        <table cellpadding="3" cellspacing="0">
            <xsl:for-each select="CheckInEvent/Artifacts/Artifact[@artifactType='Changeset']">
                <tr>
                    <td><xsl:apply-templates select="Uri" /></td>
                </tr>
            </xsl:for-each>
        </table>
        <h2>File(s)/Folder(s)</h2>
        <hr/>
            <table cellpadding="3" cellspacing="0">
                <xsl:for-each select="CheckInEvent/Artifacts/Artifact[@artifactType='VersionedItem']">
                    <tr><td><xsl:apply-templates select="Uri" /></td></tr>
                </xsl:for-each>
            </table>
        <p>You are receiving this notification because of a subscription to events affecting
            one or more of the above files and/or changesets. Contact your project
            administrator if you want to stop receiving these notifications.</p>
    </body>
    </xsl:template>

    <xsl:template match="Uri">
        <A>
            <xsl:attribute name="HREF">
                <xsl:apply-templates/> 
            </xsl:attribute>
            <xsl:value-of select="."/> 
        </A>
    </xsl:template>

</xsl:stylesheet>

See Also

Concepts

Eventing Service

Eventing Service Architecture

Defining TFS Events

Subscribing to TFS Events

Filtering Team Foundation Server Events

Integrating a Web Service Notification Customer

Integrating with Team Foundation Server Security