[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

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


Subject: [xsl] Saxon Error: Conditional Transformation Matches BOTH of "Either/Or" Template
From: Raymond Lillibridge <RLillibridge@xxxxxxxxxxxx>
Date: Wed, 5 Jun 2013 18:58:22 +0000

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.

Current Thread
Keywords