xsl-list
[Top] [All Lists]

[xsl] Compare logical expressions with XPath/XSLT

2019-03-07 09:53:46
Hi, 

I have a problem at hand that (I think) I understood on the whiteboard, but 
have no initial idea how to best tackle this using our beloved tools (currently 
limited to XSLT/XPath 2).

We have larger objects (documents) and many child objects (chapters), and both 
can have a property, let's call it "Project Name". The task is to find 
conflicts between the document's and the chapter's project setting. Behind each 
project name there is a configurable boolean expression using AND, OR and NOT, 
which defines whether two projects may match or not.

The definition of project names looks like this (with required="false" 
describing the NOT logic):

<defs>
  <def name="project-1">
    <set>
      <AND>
        <OR>
          <item required="false">A</item>
          <item required="false">B</item>
        </OR>
        <item required="false">C</item>
      </AND>
    </set>
  </def>
  <def name="project-2">
    <set>
      <OR>
        <item required="true">A</item>
        <item required="true">C</item>
      </OR>
    </set>
  </def>
  <def name="project-3">
    <set>
      <item required="false">C</item>
    </set>
  </def>
</defs>

If the document uses "project-1", a chapter with "project-2" would be in 
conflict with project-1, because { A OR C } is not a subset of { (!A OR !B) AND 
!C }.

A chapter with "project-3" would be okay, because { !C } is a subset of { (!A 
OR !B) AND !C }.

I simply hope for some pointers to similar problems.

Thanks a lot for your time,

- Michael Müller-Hillebrand
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>