diff options
author | Mike Gerwitz <mike.gerwitz@rtspecialty.com> | 2018-02-19 13:56:08 -0500 |
---|---|---|
committer | Mike Gerwitz <mike.gerwitz@rtspecialty.com> | 2018-02-19 13:56:08 -0500 |
commit | 7f26db41b211694530acb5c3cd881c14e508b7df (patch) | |
tree | 4d7f33158173561ccb0969acb3d03c287d92ddd7 | |
parent | 34b82e7f7ed470c2bfec4ef1122ce026dae523d9 (diff) | |
download | tame-7f26db41b211694530acb5c3cd881c14e508b7df.tar.gz tame-7f26db41b211694530acb5c3cd881c14e508b7df.tar.bz2 tame-7f26db41b211694530acb5c3cd881c14e508b7df.zip |
Properly re-order classification predicates of any dimensionv2.9.3
In order for the cmatch algorithm to work properly, predicates must be
re-ordered on @dim descending.
* src/current/compiler/js.xsl (compile)[lv:classify]: Order all different
dimensions, not just scalars.
-rw-r--r-- | src/current/compiler/js.xsl | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/src/current/compiler/js.xsl b/src/current/compiler/js.xsl index bc35546..6674140 100644 --- a/src/current/compiler/js.xsl +++ b/src/current/compiler/js.xsl @@ -533,9 +533,11 @@ <text>'] = (function(){var result,tmp; </text> </if> - <!-- locate classification criteria --> + <!-- locate classification criteria (since lv:any and lv:all are split + into their own classifications, matching on any depth ensures we get + into any preproc:* nodes as well) --> <variable name="criteria" as="element( lv:match )*" - select="lv:match[ + select="./lv:match[ not( $ignores ) or not( @on=$ignores/@ref ) ]" /> @@ -561,31 +563,23 @@ <choose> <!-- if classification criteria were provided, then use them --> <when test="$criteria"> - <variable name="criteria-scalar" as="element( lv:match )*" - select="$criteria[ - @on = $criteria-syms[ - @dim = '0' ]/@name ]" /> - <variable name="op" as="xs:string" select="compiler:match-group-op( $self )" /> <text></text> - <!-- first, non-scalar criteria --> + <!-- order matches from highest to lowest dimensions (required for + the cmatch algorithm)--> + <for-each select="reverse( xs:integer( min( $criteria-syms/@dim ) ) + to xs:integer( max( $criteria-syms/@dim ) ) )"> <apply-templates mode="compile" select="$criteria[ - not( @on = $criteria-scalar/@on ) ]"> - <with-param name="result-set" select="$result-set" /> - <with-param name="ignores" select="$ignores" /> - <with-param name="operator" select="$op" /> - </apply-templates> - - <!-- scalars must be matched last --> - <apply-templates mode="compile" - select="$criteria-scalar"> + @on = $criteria-syms[ + @dim = current() ]/@name ]"> <with-param name="result-set" select="$result-set" /> <with-param name="ignores" select="$ignores" /> <with-param name="operator" select="$op" /> </apply-templates> + </for-each> </when> <!-- if no classification criteria, then always true/false --> |