Alright, here goes a reduced form of the input.xml and stylesheet.
This is as small as I can get the input on short notice, but the
stylesheet is relatively simple. I use saxon8.jar command line to run
the standalone stylesheet against the input.xml. Toggling line 163
(comment vs no comment) would yield the unexpected, from my stand
point, result.
I really appreciate the help guys.
XML:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<S1000DEffectivity>
<inlineapplics>
<applic id = "A-G1C0" >
<displaytext>Group 1</displaytext>
<evaluate operator = "and">
<evaluate operator = "and" >
<evaluate operator = "or" >
<evaluate operator = "and" >
<assert actreftype = "prodattr" actidref
= "lineno" actvalues = "1~35" />
<assert actreftype = "prodattr" actidref
= "primary" actvalues = "ZA030~ZA039" />
</evaluate>
<assert actreftype = "prodattr" actidref =
"serialno" actvalues = "34743" />
</evaluate>
<assert actreftype = "prodattr" actidref =
"typecertmodel" actvalues = "787-8" />
</evaluate>
<assert>AIRPLANES WITH HATS</assert>
</evaluate>
</applic>
<applic id = "A-G2C0" >
<displaytext>Group 2</displaytext>
<evaluate operator = "and" >
<evaluate operator = "and" >
<evaluate operator = "and" >
<evaluate operator = "and" >
<assert actreftype = "prodattr" actidref
= "lineno" actvalues = "36~9999" />
<assert actreftype = "prodattr" actidref
= "primary" actvalues = "ZA030~ZA039" />
</evaluate>
<assert actreftype = "prodattr" actidref =
"serialno" actvalues = "36000~38000" />
</evaluate>
<assert actreftype = "prodattr" actidref =
"typecertmodel" actvalues = "787-8" />
</evaluate>
<assert>AIRPLANES WITH HELMETS</assert>
</evaluate>
</applic>
<applic id = "A-G3C0" >
<displaytext>Group 3</displaytext>
<evaluate operator = "and" >
<evaluate operator = "and" >
<evaluate operator = "or" >
<evaluate operator = "or" >
<assert actreftype = "prodattr" actidref
= "lineno" actvalues = "1~3|5~6" />
<assert actreftype = "prodattr" actidref
= "serialno" actvalues = "34638" />
</evaluate>
<assert actreftype = "prodattr" actidref =
"primary" actvalues = "ZA044~ZA099" />
</evaluate>
<assert actreftype = "prodattr" actidref =
"typecertmodel" actvalues = "787-8" />
</evaluate>
<assert>AIRPLANES WITH SKIRTS</assert>
</evaluate>
</applic>
<applic id = "A-G4C0" >
<displaytext>Group 4</displaytext>
<evaluate operator = "and">
<evaluate operator = "and" >
<evaluate operator = "or" >
<evaluate operator = "and" >
<assert actreftype = "prodattr" actidref
= "primary" actvalues = "ZA030~ZA040" />
<assert actreftype = "prodattr" actidref
= "serialno" actvalues = "35939~35999" />
</evaluate>
<evaluate operator = "and" >
<assert actreftype = "prodattr" actidref
= "serialno" actvalues = "34600~34899" />
<assert actreftype = "prodattr" actidref
= "primary" actvalues = "ZA036~ZA043" />
</evaluate>
</evaluate>
<assert actreftype = "prodattr" actidref =
"typecertmodel" actvalues = "787-8" />
</evaluate>
<assert>AIRPLANES WITH PANTS</assert>
</evaluate>
</applic>
<applic id = "A-G4C1" >
<displaytext>Group 4, Configuration 1</
displaytext>
<evaluate operator = "and">
<evaluate operator = "and" >
<evaluate operator = "or" >
<evaluate operator = "and" >
<assert actreftype = "prodattr" actidref
= "primary" actvalues = "ZA030~ZA040" />
<assert actreftype = "prodattr" actidref
= "serialno" actvalues = "35939~35999" />
</evaluate>
<evaluate operator = "and" >
<assert actreftype = "prodattr" actidref
= "serialno" actvalues = "34600~34899" />
<assert actreftype = "prodattr" actidref
= "primary" actvalues = "ZA036~ZA043" />
</evaluate>
</evaluate>
<assert actreftype = "prodattr" actidref =
"typecertmodel" actvalues = "787-8" />
</evaluate>
<assert>AIRPLANES WITH BLUE PANTS</assert>
</evaluate>
</applic>
<applic id = "A-G4C2" >
<displaytext>Group 4, Configuration 2</
displaytext>
<evaluate operator = "and">
<evaluate operator = "and" >
<evaluate operator = "or" >
<evaluate operator = "and" >
<assert actreftype = "prodattr" actidref
= "primary" actvalues = "ZA030~ZA040" />
<assert actreftype = "prodattr" actidref
= "serialno" actvalues = "35939~35999" />
</evaluate>
<evaluate operator = "and" >
<assert actreftype = "prodattr" actidref
= "serialno" actvalues = "34600~34899" />
<assert actreftype = "prodattr" actidref
= "primary" actvalues = "ZA036~ZA043" />
</evaluate>
</evaluate>
<assert actreftype = "prodattr" actidref =
"typecertmodel" actvalues = "787-8" />
</evaluate>
<assert>AIRPLANES WITH GREEN PANTS</assert>
</evaluate>
</applic>
<applic id = "A-G4C3" >
<displaytext>Group 4, Configuration 3</
displaytext>
<evaluate operator = "and">
<evaluate operator = "and" >
<evaluate operator = "or" >
<evaluate operator = "and" >
<assert actreftype = "prodattr" actidref
= "primary" actvalues = "ZA030~ZA040" />
<assert actreftype = "prodattr" actidref
= "serialno" actvalues = "35939~35999" />
</evaluate>
<evaluate operator = "and" >
<assert actreftype = "prodattr" actidref
= "serialno" actvalues = "34600~34899" />
<assert actreftype = "prodattr" actidref
= "primary" actvalues = "ZA036~ZA043" />
</evaluate>
</evaluate>
<assert actreftype = "prodattr" actidref =
"typecertmodel" actvalues = "787-8" />
</evaluate>
<assert>AIRPLANES WITH RED PANTS</assert>
</evaluate>
</applic>
<applic id = "A-G4C4" >
<displaytext>Group 4, Configuration 4</
displaytext>
<evaluate operator = "and">
<evaluate operator = "and" >
<evaluate operator = "or" >
<evaluate operator = "and" >
<assert actreftype = "prodattr" actidref
= "primary" actvalues = "ZA030~ZA040" />
<assert actreftype = "prodattr" actidref
= "serialno" actvalues = "35939~35999" />
</evaluate>
<evaluate operator = "and" >
<assert actreftype = "prodattr" actidref
= "serialno" actvalues = "34600~34899" />
<assert actreftype = "prodattr" actidref
= "primary" actvalues = "ZA036~ZA043" />
</evaluate>
</evaluate>
<assert actreftype = "prodattr" actidref =
"typecertmodel" actvalues = "787-8" />
</evaluate>
<assert>AIRPLANES WITH ORANGE PANTS</assert>
</evaluate>
</applic>
<applic id = "A-G4C5" >
<displaytext>Group 4, Configuration 5</
displaytext>
<evaluate operator = "and">
<evaluate operator = "and" >
<evaluate operator = "or" >
<evaluate operator = "and" >
<assert actreftype = "prodattr" actidref
= "primary" actvalues = "ZA030~ZA040" />
<assert actreftype = "prodattr" actidref
= "serialno" actvalues = "35939~35999" />
</evaluate>
<evaluate operator = "and" >
<assert actreftype = "prodattr" actidref
= "serialno" actvalues = "34600~34899" />
<assert actreftype = "prodattr" actidref
= "primary" actvalues = "ZA036~ZA043" />
</evaluate>
</evaluate>
<assert actreftype = "prodattr" actidref =
"typecertmodel" actvalues = "787-8" />
</evaluate>
<assert>AIRPLANES WITH PURPLE PANTS</assert>
</evaluate>
</applic>
<applic id = "A-G4C6" >
<displaytext>Group 4, Configuration 6</
displaytext>
<evaluate operator = "and">
<evaluate operator = "and" >
<evaluate operator = "or" >
<evaluate operator = "and" >
<assert actreftype = "prodattr" actidref
= "primary" actvalues = "ZA030~ZA040" />
<assert actreftype = "prodattr" actidref
= "serialno" actvalues = "35939~35999" />
</evaluate>
<evaluate operator = "and" >
<assert actreftype = "prodattr" actidref
= "serialno" actvalues = "34600~34899" />
<assert actreftype = "prodattr" actidref
= "primary" actvalues = "ZA036~ZA043" />
</evaluate>
</evaluate>
<assert actreftype = "prodattr" actidref =
"typecertmodel" actvalues = "787-8" />
</evaluate>
<assert>AIRPLANES WITH MAUVE PANTS</assert>
</evaluate>
</applic>
<applic id = "A-G4C7" >
<displaytext>Group 4, Configuration 7</
displaytext>
<evaluate operator = "and">
<evaluate operator = "and" >
<evaluate operator = "or" >
<evaluate operator = "and" >
<assert actreftype = "prodattr" actidref
= "primary" actvalues = "ZA030~ZA040" />
<assert actreftype = "prodattr" actidref
= "serialno" actvalues = "35939~35999" />
</evaluate>
<evaluate operator = "and" >
<assert actreftype = "prodattr" actidref
= "serialno" actvalues = "34600~34899" />
<assert actreftype = "prodattr" actidref
= "primary" actvalues = "ZA036~ZA043" />
</evaluate>
</evaluate>
<assert actreftype = "prodattr" actidref =
"typecertmodel" actvalues = "787-8" />
</evaluate>
<assert>AIRPLANES WITH TURQUOISE PANTS</
assert>
</evaluate>
</applic>
<applic id = "A-G4C8" >
<displaytext>Group 4, Configuration 8</
displaytext>
<evaluate operator = "and">
<evaluate operator = "and" >
<evaluate operator = "or" >
<evaluate operator = "and" >
<assert actreftype = "prodattr" actidref
= "primary" actvalues = "ZA030~ZA040" />
<assert actreftype = "prodattr" actidref
= "serialno" actvalues = "35939~35999" />
</evaluate>
<evaluate operator = "and" >
<assert actreftype = "prodattr" actidref
= "serialno" actvalues = "34600~34899" />
<assert actreftype = "prodattr" actidref
= "primary" actvalues = "ZA036~ZA043" />
</evaluate>
</evaluate>
<assert actreftype = "prodattr" actidref =
"typecertmodel" actvalues = "787-8" />
</evaluate>
<assert>AIRPLANES WITH CRIMSON PANTS</assert>
</evaluate>
</applic>
<applic id = "A-G4C9" >
<displaytext>Group 4, Configuration 9</
displaytext>
<evaluate operator = "and">
<evaluate operator = "and" >
<evaluate operator = "or" >
<evaluate operator = "and" >
<assert actreftype = "prodattr" actidref
= "primary" actvalues = "ZA030~ZA040" />
<assert actreftype = "prodattr" actidref
= "serialno" actvalues = "35939~35999" />
</evaluate>
<evaluate operator = "and" >
<assert actreftype = "prodattr" actidref
= "serialno" actvalues = "34600~34899" />
<assert actreftype = "prodattr" actidref
= "primary" actvalues = "ZA036~ZA043" />
</evaluate>
</evaluate>
<assert actreftype = "prodattr" actidref =
"typecertmodel" actvalues = "787-8" />
</evaluate>
<assert>AIRPLANES WITH MAGENTA PANTS</assert>
</evaluate>
</applic>
<applic id = "A-G4C10" >
<displaytext>Group 4, Configuration 10</
displaytext>
<evaluate operator = "and">
<evaluate operator = "and" >
<evaluate operator = "or" >
<evaluate operator = "and" >
<assert actreftype = "prodattr" actidref
= "primary" actvalues = "ZA030~ZA040" />
<assert actreftype = "prodattr" actidref
= "serialno" actvalues = "35939~35999" />
</evaluate>
<evaluate operator = "and" >
<assert actreftype = "prodattr" actidref
= "serialno" actvalues = "34600~34899" />
<assert actreftype = "prodattr" actidref
= "primary" actvalues = "ZA036~ZA043" />
</evaluate>
</evaluate>
<assert actreftype = "prodattr" actidref =
"typecertmodel" actvalues = "787-8" />
</evaluate>
<assert>AIRPLANES WITH TEAL PANTS</assert>
</evaluate>
</applic>
<applic id = "A-G4C11" >
<displaytext>Group 4, Configuration 11</
displaytext>
<evaluate operator = "and">
<evaluate operator = "and" >
<evaluate operator = "or" >
<evaluate operator = "and" >
<assert actreftype = "prodattr" actidref
= "primary" actvalues = "ZA030~ZA040" />
<assert actreftype = "prodattr" actidref
= "serialno" actvalues = "35939~35999" />
</evaluate>
<evaluate operator = "and" >
<assert actreftype = "prodattr" actidref
= "serialno" actvalues = "34600~34899" />
<assert actreftype = "prodattr" actidref
= "primary" actvalues = "ZA036~ZA043" />
</evaluate>
</evaluate>
<assert actreftype = "prodattr" actidref =
"typecertmodel" actvalues = "787-8" />
</evaluate>
<assert>AIRPLANES WITH BROWN PANTS</assert>
</evaluate>
</applic>
<applic id = "A-G4C12" >
<displaytext>Group 4, Configuration 12</
displaytext>
<evaluate operator = "and">
<evaluate operator = "and" >
<evaluate operator = "or" >
<evaluate operator = "and" >
<assert actreftype = "prodattr" actidref
= "primary" actvalues = "ZA030~ZA040" />
<assert actreftype = "prodattr" actidref
= "serialno" actvalues = "35939~35999" />
</evaluate>
<evaluate operator = "and" >
<assert actreftype = "prodattr" actidref
= "serialno" actvalues = "34600~34899" />
<assert actreftype = "prodattr" actidref
= "primary" actvalues = "ZA036~ZA043" />
</evaluate>
</evaluate>
<assert actreftype = "prodattr" actidref =
"typecertmodel" actvalues = "787-8" />
</evaluate>
<assert>AIRPLANES WITH FUSCHIA PANTS</assert>
</evaluate>
</applic>
<applic id = "A-G1C0G2C0" >
<displaytext>Group 1-2</displaytext>
<evaluate operator = "or">
<evaluate operator = "and">
<evaluate operator = "and" >
<evaluate operator = "or" >
<evaluate operator = "and" >
<assert actreftype = "prodattr"
actidref = "lineno" actvalues = "1~35" />
<assert actreftype = "prodattr"
actidref = "primary" actvalues = "ZA030~ZA039" />
</evaluate>
<assert actreftype = "prodattr" actidref
= "serialno" actvalues = "34743" />
</evaluate>
<assert actreftype = "prodattr" actidref =
"typecertmodel" actvalues = "787-8" />
</evaluate>
<assert>AIRPLANES WITH HATS</assert>
</evaluate>
<evaluate operator = "and" >
<evaluate operator = "and" >
<evaluate operator = "and" >
<evaluate operator = "and" >
<assert actreftype = "prodattr"
actidref = "lineno" actvalues = "36~9999" />
<assert actreftype = "prodattr"
actidref = "primary" actvalues = "ZA030~ZA039" />
</evaluate>
<assert actreftype = "prodattr" actidref
= "serialno" actvalues = "36000~38000" />
</evaluate>
<assert actreftype = "prodattr" actidref =
"typecertmodel" actvalues = "787-8" />
</evaluate>
<assert>AIRPLANES WITH HELMETS</assert>
</evaluate>
</evaluate>
</applic>
<applic id = "A-G1C0G4C1G4C2" >
<displaytext>Group 1; Group 4, Configuration
1-2</displaytext>
<evaluate operator = "or">
<evaluate operator = "and">
<evaluate operator = "and" >
<evaluate operator = "or" >
<evaluate operator = "and" >
<assert actreftype = "prodattr"
actidref = "lineno" actvalues = "1~35" />
<assert actreftype = "prodattr"
actidref = "primary" actvalues = "ZA030~ZA039" />
</evaluate>
<assert actreftype = "prodattr" actidref
= "serialno" actvalues = "34743" />
</evaluate>
<assert actreftype = "prodattr" actidref =
"typecertmodel" actvalues = "787-8" />
</evaluate>
<assert>AIRPLANES WITH HATS</assert>
</evaluate>
<evaluate operator = "and">
<evaluate operator = "and" >
<evaluate operator = "or" >
<evaluate operator = "and" >
<assert actreftype = "prodattr"
actidref = "primary" actvalues = "ZA030~ZA040" />
<assert actreftype = "prodattr"
actidref = "serialno" actvalues = "35939~35999" />
</evaluate>
<evaluate operator = "and" >
<assert actreftype = "prodattr"
actidref = "serialno" actvalues = "34600~34899" />
<assert actreftype = "prodattr"
actidref = "primary" actvalues = "ZA036~ZA043" />
</evaluate>
</evaluate>
<assert actreftype = "prodattr" actidref =
"typecertmodel" actvalues = "787-8" />
</evaluate>
<assert>AIRPLANES WITH BLUE PANTS</assert>
</evaluate>
<evaluate operator = "and">
<evaluate operator = "and" >
<evaluate operator = "or" >
<evaluate operator = "and" >
<assert actreftype = "prodattr"
actidref = "primary" actvalues = "ZA030~ZA040" />
<assert actreftype = "prodattr"
actidref = "serialno" actvalues = "35939~35999" />
</evaluate>
<evaluate operator = "and" >
<assert actreftype = "prodattr"
actidref = "serialno" actvalues = "34600~34899" />
<assert actreftype = "prodattr"
actidref = "primary" actvalues = "ZA036~ZA043" />
</evaluate>
</evaluate>
<assert actreftype = "prodattr" actidref =
"typecertmodel" actvalues = "787-8" />
</evaluate>
<assert>AIRPLANES WITH GREEN PANTS</assert>
</evaluate>
</evaluate>
</applic>
<applic id = "A-
G1C0G4C1G4C2G4C4G4C5G4C6G4C7G4C8G4C9G4C10G4C11G4C12" >
<displaytext>Group 1; Group 4, Configuration
1-2, 4-12</displaytext>
<evaluate operator = "or">
<evaluate operator = "and">
<evaluate operator = "and" >
<evaluate operator = "or" >
<evaluate operator = "and" >
<assert actreftype = "prodattr"
actidref = "lineno" actvalues = "1~35" />
<assert actreftype = "prodattr"
actidref = "primary" actvalues = "ZA030~ZA039" />
</evaluate>
<assert actreftype = "prodattr" actidref
= "serialno" actvalues = "34743" />
</evaluate>
<assert actreftype = "prodattr" actidref =
"typecertmodel" actvalues = "787-8" />
</evaluate>
<assert>AIRPLANES WITH HATS</assert>
</evaluate>
<evaluate operator = "and">
<evaluate operator = "and" >
<evaluate operator = "or" >
<evaluate operator = "and" >
<assert actreftype = "prodattr"
actidref = "primary" actvalues = "ZA030~ZA040" />
<assert actreftype = "prodattr"
actidref = "serialno" actvalues = "35939~35999" />
</evaluate>
<evaluate operator = "and" >
<assert actreftype = "prodattr"
actidref = "serialno" actvalues = "34600~34899" />
<assert actreftype = "prodattr"
actidref = "primary" actvalues = "ZA036~ZA043" />
</evaluate>
</evaluate>
<assert actreftype = "prodattr" actidref =
"typecertmodel" actvalues = "787-8" />
</evaluate>
<assert>AIRPLANES WITH BLUE PANTS</assert>
</evaluate>
<evaluate operator = "and">
<evaluate operator = "and" >
<evaluate operator = "or" >
<evaluate operator = "and" >
<assert actreftype = "prodattr"
actidref = "primary" actvalues = "ZA030~ZA040" />
<assert actreftype = "prodattr"
actidref = "serialno" actvalues = "35939~35999" />
</evaluate>
<evaluate operator = "and" >
<assert actreftype = "prodattr"
actidref = "serialno" actvalues = "34600~34899" />
<assert actreftype = "prodattr"
actidref = "primary" actvalues = "ZA036~ZA043" />
</evaluate>
</evaluate>
<assert actreftype = "prodattr" actidref =
"typecertmodel" actvalues = "787-8" />
</evaluate>
<assert>AIRPLANES WITH GREEN PANTS</assert>
</evaluate>
<evaluate operator = "and">
<evaluate operator = "and" >
<evaluate operator = "or" >
<evaluate operator = "and" >
<assert actreftype = "prodattr"
actidref = "primary" actvalues = "ZA030~ZA040" />
<assert actreftype = "prodattr"
actidref = "serialno" actvalues = "35939~35999" />
</evaluate>
<evaluate operator = "and" >
<assert actreftype = "prodattr"
actidref = "serialno" actvalues = "34600~34899" />
<assert actreftype = "prodattr"
actidref = "primary" actvalues = "ZA036~ZA043" />
</evaluate>
</evaluate>
<assert actreftype = "prodattr" actidref =
"typecertmodel" actvalues = "787-8" />
</evaluate>
<assert>AIRPLANES WITH ORANGE PANTS</assert>
</evaluate>
<evaluate operator = "and">
<evaluate operator = "and" >
<evaluate operator = "or" >
<evaluate operator = "and" >
<assert actreftype = "prodattr"
actidref = "primary" actvalues = "ZA030~ZA040" />
<assert actreftype = "prodattr"
actidref = "serialno" actvalues = "35939~35999" />
</evaluate>
<evaluate operator = "and" >
<assert actreftype = "prodattr"
actidref = "serialno" actvalues = "34600~34899" />
<assert actreftype = "prodattr"
actidref = "primary" actvalues = "ZA036~ZA043" />
</evaluate>
</evaluate>
<assert actreftype = "prodattr" actidref =
"typecertmodel" actvalues = "787-8" />
</evaluate>
<assert>AIRPLANES WITH PURPLE PANTS</assert>
</evaluate>
<evaluate operator = "and">
<evaluate operator = "and" >
<evaluate operator = "or" >
<evaluate operator = "and" >
<assert actreftype = "prodattr"
actidref = "primary" actvalues = "ZA030~ZA040" />
<assert actreftype = "prodattr"
actidref = "serialno" actvalues = "35939~35999" />
</evaluate>
<evaluate operator = "and" >
<assert actreftype = "prodattr"
actidref = "serialno" actvalues = "34600~34899" />
<assert actreftype = "prodattr"
actidref = "primary" actvalues = "ZA036~ZA043" />
</evaluate>
</evaluate>
<assert actreftype = "prodattr" actidref =
"typecertmodel" actvalues = "787-8" />
</evaluate>
<assert>AIRPLANES WITH MAUVE PANTS</assert>
</evaluate>
<evaluate operator = "and">
<evaluate operator = "and" >
<evaluate operator = "or" >
<evaluate operator = "and" >
<assert actreftype = "prodattr"
actidref = "primary" actvalues = "ZA030~ZA040" />
<assert actreftype = "prodattr"
actidref = "serialno" actvalues = "35939~35999" />
</evaluate>
<evaluate operator = "and" >
<assert actreftype = "prodattr"
actidref = "serialno" actvalues = "34600~34899" />
<assert actreftype = "prodattr"
actidref = "primary" actvalues = "ZA036~ZA043" />
</evaluate>
</evaluate>
<assert actreftype = "prodattr" actidref =
"typecertmodel" actvalues = "787-8" />
</evaluate>
<assert>AIRPLANES WITH TURQUOISE PANTS</
assert>
</evaluate>
<evaluate operator = "and">
<evaluate operator = "and" >
<evaluate operator = "or" >
<evaluate operator = "and" >
<assert actreftype = "prodattr"
actidref = "primary" actvalues = "ZA030~ZA040" />
<assert actreftype = "prodattr"
actidref = "serialno" actvalues = "35939~35999" />
</evaluate>
<evaluate operator = "and" >
<assert actreftype = "prodattr"
actidref = "serialno" actvalues = "34600~34899" />
<assert actreftype = "prodattr"
actidref = "primary" actvalues = "ZA036~ZA043" />
</evaluate>
</evaluate>
<assert actreftype = "prodattr" actidref =
"typecertmodel" actvalues = "787-8" />
</evaluate>
<assert>AIRPLANES WITH CRIMSON PANTS</assert>
</evaluate>
<evaluate operator = "and">
<evaluate operator = "and" >
<evaluate operator = "or" >
<evaluate operator = "and" >
<assert actreftype = "prodattr"
actidref = "primary" actvalues = "ZA030~ZA040" />
<assert actreftype = "prodattr"
actidref = "serialno" actvalues = "35939~35999" />
</evaluate>
<evaluate operator = "and" >
<assert actreftype = "prodattr"
actidref = "serialno" actvalues = "34600~34899" />
<assert actreftype = "prodattr"
actidref = "primary" actvalues = "ZA036~ZA043" />
</evaluate>
</evaluate>
<assert actreftype = "prodattr" actidref =
"typecertmodel" actvalues = "787-8" />
</evaluate>
<assert>AIRPLANES WITH MAGENTA PANTS</
assert>
</evaluate>
<evaluate operator = "and">
<evaluate operator = "and" >
<evaluate operator = "or" >
<evaluate operator = "and" >
<assert actreftype = "prodattr"
actidref = "primary" actvalues = "ZA030~ZA040" />
<assert actreftype = "prodattr"
actidref = "serialno" actvalues = "35939~35999" />
</evaluate>
<evaluate operator = "and" >
<assert actreftype = "prodattr"
actidref = "serialno" actvalues = "34600~34899" />
<assert actreftype = "prodattr"
actidref = "primary" actvalues = "ZA036~ZA043" />
</evaluate>
</evaluate>
<assert actreftype = "prodattr" actidref =
"typecertmodel" actvalues = "787-8" />
</evaluate>
<assert>AIRPLANES WITH TEAL PANTS</assert>
</evaluate>
<evaluate operator = "and">
<evaluate operator = "and" >
<evaluate operator = "or" >
<evaluate operator = "and" >
<assert actreftype = "prodattr"
actidref = "primary" actvalues = "ZA030~ZA040" />
<assert actreftype = "prodattr"
actidref = "serialno" actvalues = "35939~35999" />
</evaluate>
<evaluate operator = "and" >
<assert actreftype = "prodattr"
actidref = "serialno" actvalues = "34600~34899" />
<assert actreftype = "prodattr"
actidref = "primary" actvalues = "ZA036~ZA043" />
</evaluate>
</evaluate>
<assert actreftype = "prodattr" actidref =
"typecertmodel" actvalues = "787-8" />
</evaluate>
<assert>AIRPLANES WITH BROWN PANTS</assert>
</evaluate>
<evaluate operator = "and">
<evaluate operator = "and" >
<evaluate operator = "or" >
<evaluate operator = "and" >
<assert actreftype = "prodattr"
actidref = "primary" actvalues = "ZA030~ZA040" />
<assert actreftype = "prodattr"
actidref = "serialno" actvalues = "35939~35999" />
</evaluate>
<evaluate operator = "and" >
<assert actreftype = "prodattr"
actidref = "serialno" actvalues = "34600~34899" />
<assert actreftype = "prodattr"
actidref = "primary" actvalues = "ZA036~ZA043" />
</evaluate>
</evaluate>
<assert actreftype = "prodattr" actidref =
"typecertmodel" actvalues = "787-8" />
</evaluate>
<assert>AIRPLANES WITH FUSCHIA PANTS</
assert>
</
evaluate>
</evaluate>
</applic>
<applic id = "A-G4C10G4C11G4C12" >
<displaytext>Group 4, Configuration 10-12</
displaytext>
<evaluate operator = "or">
<evaluate operator = "and">
<evaluate operator = "and" >
<evaluate operator = "or" >
<evaluate operator = "and" >
<assert actreftype = "prodattr"
actidref = "primary" actvalues = "ZA030~ZA040" />
<assert actreftype = "prodattr"
actidref = "serialno" actvalues = "35939~35999" />
</evaluate>
<evaluate operator = "and" >
<assert actreftype = "prodattr"
actidref = "serialno" actvalues = "34600~34899" />
<assert actreftype = "prodattr"
actidref = "primary" actvalues = "ZA036~ZA043" />
</evaluate>
</evaluate>
<assert actreftype = "prodattr" actidref =
"typecertmodel" actvalues = "787-8" />
</evaluate>
<assert>AIRPLANES WITH TEAL PANTS</assert>
</evaluate>
<evaluate operator = "and">
<evaluate operator = "and" >
<evaluate operator = "or" >
<evaluate operator = "and" >
<assert actreftype = "prodattr"
actidref = "primary" actvalues = "ZA030~ZA040" />
<assert actreftype = "prodattr"
actidref = "serialno" actvalues = "35939~35999" />
</evaluate>
<evaluate operator = "and" >
<assert actreftype = "prodattr"
actidref = "serialno" actvalues = "34600~34899" />
<assert actreftype = "prodattr"
actidref = "primary" actvalues = "ZA036~ZA043" />
</evaluate>
</evaluate>
<assert actreftype = "prodattr" actidref =
"typecertmodel" actvalues = "787-8" />
</evaluate>
<assert>AIRPLANES WITH BROWN PANTS</assert>
</evaluate>
<evaluate operator = "and">
<evaluate operator = "and" >
<evaluate operator = "or" >
<evaluate operator = "and" >
<assert actreftype = "prodattr"
actidref = "primary" actvalues = "ZA030~ZA040" />
<assert actreftype = "prodattr"
actidref = "serialno" actvalues = "35939~35999" />
</evaluate>
<evaluate operator = "and" >
<assert actreftype = "prodattr"
actidref = "serialno" actvalues = "34600~34899" />
<assert actreftype = "prodattr"
actidref = "primary" actvalues = "ZA036~ZA043" />
</evaluate>
</evaluate>
<assert actreftype = "prodattr" actidref =
"typecertmodel" actvalues = "787-8" />
</evaluate>
<assert>AIRPLANES WITH FUSCHIA PANTS</
assert>
</evaluate>
</evaluate>
</applic>
</inlineapplics>
</S1000DEffectivity>
<Figure
applicability="1:0;4:1;4:2;4:4;4:5;4:6;4:7;4:8;4:9;4:10;4:11;4:12" />
</root>
XSLT:
<?xml version="1.0"?>
<xsl:stylesheet version="2.0" xmlns:xsl="
http://www.w3.org/1999/XSL/
Transform"
xmlns:exsl="
http://exslt.org/common"
exclude-result-prefixes="exsl">
<xsl
utput method="xml" indent="yes"/>
<xsl:template match="root">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="Figure">
<xsl:result-document href="output.xml">
<xsl:call-template name="applic" />
</xsl:result-document>
</xsl:template>
<xsl:template name="refapplic-recursion">
<xsl
aram name="applicability" />
<xsl:choose>
<xsl:when test="$applicability='' or $applicability=' ' or
$applicability='All' or $applicability='all'"/>
<xsl
therwise>
<xsl:variable name="g"><xsl:call-template name="g"><xsl:with-
param name="applic" select="$applicability" /><xsl:with-param name="n"
select="1" /></xsl:call-template></xsl:variable>
<xsl:variable name="c"><xsl:call-template name="c"><xsl:with-
param name="applic" select="$applicability" /><xsl:with-param name="n"
select="1" /></xsl:call-template></xsl:variable>
<xsl:text>G</xsl:text><xsl:value-of select="$g"/>
<xsl:text>C</xsl:text><xsl:value-of select="$c"/>
<xsl:call-template name="refapplic-recursion"><xsl:with-param
name="applicability"><xsl:value-of select="substring-
after($applicability, ';')"/></xsl:with-param></xsl:call-template>
</xsl
therwise>
</xsl:choose>
</xsl:template>
<xsl:template name="g">
<xsl
aram name="applic" />
<xsl
aram name="n" />
<xsl:choose>
<xsl:when test="$n > 1">
<xsl:call-template name="g"><xsl:with-param name="applic"
select="substring-after($applic, ';')" /><xsl:with-param name="n"
select="$n - 1" /></xsl:call-template>
</xsl:when>
<xsl
therwise>
<xsl:value-of select="substring-before($applic, ':')" />
</xsl
therwise>
</xsl:choose>
</xsl:template>
<xsl:template name="c">
<xsl
aram name="applic" />
<xsl
aram name="n" />
<xsl:choose>
<xsl:when test="$n > 1">
<xsl:call-template name="c"><xsl:with-param name="applic"
select="substring-after($applic, ';')" /><xsl:with-param name="n"
select="$n - 1" /></xsl:call-template>
</xsl:when>
<xsl
therwise>
<xsl:choose>
<xsl:when test="substring-after($applic, ';')!=''">
<xsl:value-of select="substring-after(substring-
before($applic, ';'), ':')" />
</xsl:when>
<xsl
therwise>
<xsl:choose>
<xsl:when test="substring-before(substring-
after($applic, ':'), ';')!=''">
<xsl:value-of select="substring-before(substring-
after($applic, ':'), ';')"/>
</xsl:when>
</xsl
therwise>
</xsl:choose>
</xsl
therwise>
</xsl:choose>
</xsl
therwise>
</xsl:choose>
</xsl:template>
<xsl:template name="applic">
<applic>
<xsl:variable name="mra-string">
<xsl:text>A-</xsl:text><xsl:call-template name="refapplic-
recursion"><xsl:with-param name="applicability"><xsl:value-of
select="@applicability" /></xsl:with-param></xsl:call-
template>
</xsl:variable>
<xsl:for-each select="//S1000DEffectivity">
<xsl:for-each select="inlineapplics">
<xsl:variable name="correct-applic">
<xsl:apply-templates select="applic" mode="unique">
<xsl:with-param name="mra-string"><xsl:copy-of
select="$mra-string" /></xsl:with-param>
</xsl:apply-templates>
</xsl:variable>
<xsl:variable name="applic-with-duplicates">
<xsl:apply-templates select="exsl:node-set($correct-
applic)" mode="correct-applic" />
</xsl:variable>
<xsl:apply-templates select="exsl:node-set($applic-with-
duplicates)" mode="string"/>
</xsl:for-each>
</xsl:for-each>
</applic>
</xsl:template>
<xsl:template match="applic" mode="unique">
<xsl
aram name="mra-string"></xsl
aram>
<xsl:variable name="id">
<xsl:value-of select="@id" />
</xsl:variable>
<xsl:if test="$mra-string = $id">
<xsl:copy-of select="." />
</xsl:if>
</xsl:template>
<xsl:template match="applic" mode="correct-applic">
<xsl:apply-templates mode="correct-applic" />
</xsl:template>
<xsl:template match="evaluate" mode="correct-applic">
<xsl:choose>
<xsl:when test="assert[.!='']">
<item-wrapper>
<xsl:apply-templates mode="correct-applic" />
</item-wrapper>
</xsl:when>
<xsl
therwise>
<xsl:copy>
<xsl:copy-of select="@*" />
<xsl:apply-templates mode="correct-applic" />
</xsl:copy>
</xsl
therwise>
</xsl:choose>
</xsl:template>
<xsl:template match="assert[.='']" mode="correct-applic">
<xsl:copy>
<xsl:copy-of select="@*" />
<xsl:apply-templates mode="correct-applic" />
</xsl:copy>
</xsl:template>
<xsl:template match="assert[.!='']" mode="correct-applic">
</xsl:template>
<xsl:template match="displaytext" mode="correct-applic">
</xsl:template>
<!-- Do a string comparison on the attributes of the trees to
determine if the trees are equal -->
<xsl:template match="item-wrapper" mode="string">
<xsl:variable name="current">
<xsl:apply-templates mode="string" />
</xsl:variable>
<xsl:variable name="rest">
<xsl:apply-templates select="following-sibling::*"
mode="string" />
</xsl:variable>
<xsl:variable name="current-normalized">
<xsl:value-of select="normalize-space($current)" />
</xsl:variable>
<xsl:variable name="rest-normalized">
<xsl:value-of select="normalize-space($rest)" />
</xsl:variable>
<!-- <fix/> What the hell? -->
<!-- <xsl:value-of select="$current-normalized"/>-->
<xsl:choose>
<xsl:when test="contains($rest-normalized, $current-
normalized)">
<duplicate/>
</xsl:when>
<xsl
therwise>
<noproblem/>
</xsl
therwise>
</xsl:choose>
</xsl:template>
<xsl:template match="/evaluate" mode="string">
<xsl:apply-templates mode="string" />
</xsl:template>
<xsl:template match="evaluate" mode="string">
<xsl:value-of select="@*" />
<xsl:apply-templates mode="string" />
</xsl:template>
<xsl:template match="assert" mode="string">
<xsl:value-of select="@*" />
<xsl:apply-templates mode="string" />
</xsl:template>
<xsl:template match="S1000DEffectivity">
</xsl:template>
</xsl:stylesheet>
Regards
Jean-Francois Michaud