XSLT Function: BaileyWeb.University.KIS.ShowWidget

The XSLT Function named ShowWidget produces the required code to add the Discover Uni widget to a course page.

The Discover Uni widget is required for all course pages on UK university websites. It displays Key Information Set (KIS) data collected by HESA and the UK Office for Students for inclusion in the Unistats dataset. For more information, please refer to the Unistats page on the HESA website.

Files

The following files are supplied with the University Package:

  • ~/App_Data/Xslt/BaileyWeb/University/KIS/ShowWidget.cshtml

Parameters

There are 5 parameters:

Parameter: Label: Help: Type: Default: Widget:
UKPRN Your UKRPN code The UKRPN for your institution. String   Text Box
KISCOURSEID The KISCOURSEID value The KISCOURSEID associated with the course in the institution's Unistats data. String   Text Box
KISMODE The KISMODE value Is the course full- or part-time? String (KISWidgetStudyModes) Full-Time Selector
Orientation Orientation How should the widget be orientated? String (KISWidgetOrientation) Horizontal Selector
Language Language What language should be displayed? English (en-GB) or Welsh (cy-GB)? String (KISWidgetLanguages) English Selector

Function Markup

<f:function name="BaileyWeb.University.KIS.Widget" xmlns:f="http://www.composite.net/ns/function/1.0">
    <f:param name="UKPRN" value="00000000" />
    <f:param name="KISCOURSEID" value="0000000000-000000" />
    <f:param name="KISMODE" value="Full-Time" />
    <f:param name="Orientation" value="Horizontal" />
    <f:param name="Language" value="English" />
</f:function>

Sub Functions

None.

Text Strings

None.

Sample Output Code

<html xmlns="http://www.w3.org/1999/xhtml">
    <head/>
    <body>
        <div class="kis-widget" data-institution="UKPRN" data-course="KISCOURSEID" data-kismode="KISMODE" data-orientation="ORIENTATION" data-language="LANGUAGE"/>
        <script> (function (d) { &quot;use strict&quot;; var widgetScript = d.createElement('script'); widgetScript.id = 'unistats-widget-script'; widgetScript.src = '//discoveruni.gov.uk/widget/embed-script'; var scriptTags = d.getElementsByTagName('script')[0]; if (d.getElementById('unistats-widget-script')) { return; } scriptTags.parentNode.insertBefore(widgetScript, scriptTags); } (document)); </script>
    </body>
</html>

Actual Output

Result with the UKPRN input parameter value set to 10007786 (University of Bristol) and the KISCOURSEID input parameter value set to 1HIST001UU-201819 (BA History). All other values are left as defaults:

Notes

In the Page Datafolder BaileyWeb.University.Courses, we provide three extensible attributes for your own data. If we use ExtensibleAttribute1 to store the KISCOURSEID value, we can inject it into the appropriate input parameter within an XSLT function. We can also infer if the course is available in both full- and part-time by checking if anything has been entered into the CourseLengthPartTime field:

<xsl:if test="string-length(Course/ExtensibleAttribute1) > 0">
    <xsl:if test="string-length(Course/CourseLengthPartTime) > 0">
        <h3>
            <lang:string key="Resource, Resources.Courses.DetailsFullTime" />
        </h3>
    </xsl:if>
    <f:function name="BaileyWeb.University.KIS.Widget" xmlns:f="http://www.composite.net/ns/function/1.0">
        <f:param name="UKPRN" value="00000000" />
        <f:param name="KISCOURSEID">
            <xsl:attribute name="value">
                <xsl:value-of select="Course/ExtensibleAttribute1" />
            </xsl:attribute>
        </f:param>
        <f:param name="KISMODE" value="Full-Time" />
        <f:param name="Orientation" value="Horizontal" />
        <f:param name="Language" value="English" />
    </f:function>
    <xsl:if test="string-length(Course/CourseLengthPartTime) > 0">
        <h3>
            <lang:string key="Resource, Resources.Courses.DetailsPartTime" />
        </h3>
        <f:function name="BaileyWeb.University.KIS.Widget" xmlns:f="http://www.composite.net/ns/function/1.0">
            <f:param name="UKPRN" value="00000000" />
            <f:param name="KISCOURSEID">
                <xsl:attribute name="value">
                    <xsl:value-of select="Course/ExtensibleAttribute1" />
                </xsl:attribute>
            </f:param>
            <f:param name="KISMODE" value="Part-Time" />
            <f:param name="Orientation" value="Horizontal" />
            <f:param name="Language" value="English" />
        </f:function>
    </xsl:if>
</xsl:if>

Updated: 06 February 2022