xsl-list
[Top] [All Lists]

[xsl] Saxon Error: Conditional Transformation Matches BOTH of "Either/Or" Template

2013-06-05 14:00:51
Group,

I'm hoping that you might be able to help me narrow down a solution for an XSLT 
transformation I'm having difficulty with.  My XML data has many <para.../> 
elements.  

My Goal:
To have a single template that matches an element under either of two 
conditions:
(a) the element does not have a given attribute ("not(@selectout)" for instance)
(b) the element has the given attribute that contains a given 
value("...contains(@selectout, 'html'") for instance)

Here are some abbreviated samples to help clarify my input.
...
<para id="para_1" selectout="none" block_type="block" gclevel="0">
This line should not be output to any of our products.
</para>

<para id="para_2" selectout="ebook html" block_type="block" gclevel="0">
This line should be output to EBOOK &amp; HTML products.
</para>

<para id="para_3" selectout="print" block_type="block" gclevel="0">
This line should be output to PRINT ONLY products.
</para>

<para id="para_4" gclevel="0" justify="center" block_type="block">
This line should be output for all products since the &amp;selectout attribute 
does not exist.
</para> 
...


Here is a copy of the match portion of my test template (XSLT 2.0):
<xsl:template match="para[not(@selectout)]  |  para[contains(@selectout, 
'html')]">
...
</template>


Using Saxon for my transformations:  
Saxon-EE 9.3.0.4J from Saxonica
Java version 1.7.0_21


Saxon error message:
Recoverable error
  XTRE0540: Ambiguous rule match for /level1/para[44]
Matches both "para[not(@selectout)] | para[contains(@selectout, 'html')]"

I'm at a loss as to how the template matches both conditions at the same time.  
From my understanding (which probably leaves much to be desired), either the 
para element doesn't have the @selectout attribute or (if it does) the 
@selectout attribute contains 'html'.


"Thanks!" to all for your kind and constructive help with this matter.
   

Cheers,
Raymond Lillibridge





--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--