Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Gerwitz <gerwitzm@lovullo.com>2017-07-05 13:42:10 -0400
committerMike Gerwitz <gerwitzm@lovullo.com>2017-07-07 15:18:20 -0400
commit68dd0706a8c16caaf7dcf09fd2ed22aa0c5cc124 (patch)
treebac097d15664ddb235340866bb8e38953030a45b
parent652465a0a0e5be93b2c5df56b3e92e6166b936bd (diff)
downloadtame-68dd0706a8c16caaf7dcf09fd2ed22aa0c5cc124.tar.gz
tame-68dd0706a8c16caaf7dcf09fd2ed22aa0c5cc124.tar.bz2
tame-68dd0706a8c16caaf7dcf09fd2ed22aa0c5cc124.zip
Simplify unknown source field map detection
Simple refactoring. Code still is terrible. * src/current/compiler/map.xsl (lvmc:validate-ui) [lvm:program-map]: Factor common expressions.
-rw-r--r--src/current/compiler/map.xsl30
1 files changed, 9 insertions, 21 deletions
diff --git a/src/current/compiler/map.xsl b/src/current/compiler/map.xsl
index 65e3190..012a945 100644
--- a/src/current/compiler/map.xsl
+++ b/src/current/compiler/map.xsl
@@ -929,31 +929,19 @@
<template match="lvm:program-map" mode="lvmc:validate-ui">
<param name="ui" />
+ <variable name="knowns" as="xs:string*"
+ select="$ui//lvp:question/@id,
+ $ui//lvp:external/@id,
+ $ui//lvp:calc/@id" />
+
<!-- get a list of unknown source mappings -->
<!-- TODO: this is a mess -->
<variable name="unknown-pre" select="
- .//lvm:pass[
- not( @name=($ui//lvp:question/@id|$ui//lvp:external/@id) )
- and not( @name=$ui//lvp:calc/@id )
- ]
- |
- .//lvm:map[
- @from
- and not( @from=($ui//lvp:question/@id|$ui//lvp:external/@id) )
- and not( @from=$ui//lvp:calc/@id )
- ]
- |
- .//lvm:from[
- not( @name=($ui//lvp:question/@id|$ui//lvp:external/@id) )
- and not( @name=$ui//lvp:calc/@id )
- ]
- |
- .//lvm:set[
- @each
- and not( @each=($ui//lvp:question/@id|$ui//lvp:external/@id) )
- and not( @each=$ui//lvp:calc/@id )
- ]
+ .//lvm:pass[ not( @name = $knowns ) ],
+ .//lvm:map[ @from and not( @from = $knowns ) ],
+ .//lvm:from[ not( @name = $knowns ) ],
+ .//lvm:set[ @each and not( @each = $knowns ) ]
" />
<variable name="unknown"