1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!-- This is a good example of an sfatables match. It's function is to verify the slice in context against a whitelist -->
4 <!-- The following lines should precede each match/target. -->
5 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
6 xmlns:exsl="http://exslt.org/common"
7 extension-element-prefixes="exsl"
10 <!-- Enter your whitelist prefixes here. Since XSLT cannot read from/write to an external archive, we need to embed the whitelist in here -->
12 <xsl:variable name="whitelist_data">
13 <hrn>plc.princeton.acb</hrn>
14 <hrn>plc.princeton.sapanb</hrn>
15 <hrn>plc.princeton.codeen</hrn>
18 <!-- Read the whitelist into a variable. Normally, one should be able to refer to $whitelist_data directly, but apparently this is something you need to do because libxml2 does not support xslt 2.0 -->
20 <xsl:variable name="whitelist" select="exsl:node-set($whitelist_data)/hrn"/>
22 <!-- Read the value of the current slice's hrn -->
23 <xsl:variable name="current_slice_hrn" select="//request-context/slice/hrn"/>
25 <!-- Define a function that checks if one of a list of prefixes (lst) matches $current_slice_hrn". It's a stupid idea to call a function a 'template' but whatever... -->
26 <xsl:template name="recurse_list">
27 <xsl:param name="lst"/>
29 <xsl:when test="count($lst)!=0">
30 <!-- Indexing in xpath has a base=1 -->
31 <xsl:variable name="head" select="$lst[1]"/>
33 <xsl:when test="starts-with($current_slice_hrn,$head)">
34 <result verdict="True"/>
37 <xsl:call-template name="recurse_list">
38 <xsl:with-param name="lst" select="$lst/following-sibling::*"/>
44 <result verdict="False"/>
49 <xsl:template match="/">
50 <xsl:call-template name="recurse_list">
51 <xsl:with-param name="lst" select="$whitelist"/>