Added separate contexts for matches and targets, instead of having combined contexts...
[sfa.git] / sfatables / processors / hrn.xsl
index 29988a5..a0adff2 100644 (file)
@@ -1,17 +1,23 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
 <xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-    <xsl:variable name="context-hrn" select="hrn"/>
-    <xsl:template match="user">
+    <xsl:variable name="context-hrn" select="//request-context//hrn"/>
+
+    <!-- Magic sauce -->
+
+    <xsl:template match="@* | node()">
+            <xsl:apply-templates select="@* | node()"/>
+    </xsl:template>
+
+    <xsl:template match="//match-context//user">
                     <xsl:choose>
                     <xsl:when test="starts-with($context-hrn, hrn)">
-                        True <!--Match -->
+                        <result verdict="True"/> <!--Match -->
                     </xsl:when>
                     <xsl:otherwise>
-                        False <!-- No match -->
+                        <result verdict="False"/> <!-- No match -->
                     </xsl:otherwise>
                 </xsl:choose>
-        <xsl:value-of select="$result"/>
     </xsl:template>
 
 </xsl:stylesheet>