[xsl] request for help resolving ambiguous rule match

Subject: [xsl] request for help resolving ambiguous rule match
From: "John A. Walsh" <jawalsh@xxxxxxxxxxx>
Date: Mon, 24 Nov 2008 11:03:35 -0500
Hello all,

In my xml (TEI P5 documents), I have structures like this:

<lg xml:id="d1e45" n="II">
	<l xml:id="d1e47" n="9">
		<q next="#d1e53" prev="#d1e37" xml:id="d1e49">
			Lo, thou hast broken the sweet yoke</q>
	<l xml:id="d1e52" rendition="#ti-1" n="10">
		<q next="#d1e57" prev="#d1e49" xml:id="d1e53">
			That my high beauty held above</q>
	<l xml:id="d1e56" n="11">
		<q next="#d1e61" prev="#d1e53" xml:id="d1e57">
			All priests and clerks and merchant-folk;</q>
	<l xml:id="d1e60" rendition="#ti-1" n="12">
		<q next="#d1e65" prev="#d1e57" xml:id="d1e61">
			There was not one but for my love</q>
	<l xml:id="d1e64" rendition="#ti-1" n="13">
		<q next="#d1e70" prev="#d1e61" xml:id="d1e65">
			Would give me gold and gold enough,</q>
	<l xml:id="d1e69" n="14">
		<q next="#d1e74" prev="#d1e65" xml:id="d1e70">
			Though sorrow his very heart had riven,</q>
	<l xml:id="d1e73" rendition="#ti-1" n="15">
		<q next="#d1e78" prev="#d1e70" xml:id="d1e74">
			To win from me such wage thereof</q>
	<l xml:id="d1e77" n="16">
		<q next="#d1e88" prev="#d1e74" xml:id="d1e78">
			As now no thief would take if given.</q>

The above represents a stanza <lg> with lines of verse <l> that
contain quotes <q> that extend over the hierarchy of the lines.  I
want to match the <q>  children (with both @next and @prev) of the
first line <l> of a stanza <lg>.

Something like this works: <xsl:template match="lg/l[position() = 1]/
q[@next and @prev]"/>

But I also have (and need) a template that simply matches "q[@next and
@prev]", so my processor (Saxon9b) is throwing a warning about an
ambiguous rule match, with ambiguity between "lg/l[position() = 1]/
q[@next and @prev]" and "q[@next and @prev]".

So my question  Can someone please help me out with another way to
express "lg/l[position() = 1]/q[@next and @prev]" that will resolve
the ambiguity?

Thank you so much.

| John A. Walsh, Assistant Professor, School of Library and
Information Science
| Indiana University, 1320 East Tenth Street, Bloomington, IN 47405
| www: <http://www.slis.indiana.edu/faculty/jawalsh/>
| Voice:812-856-0707 Fax:812-856-2062 <mailto:jawalsh@xxxxxxxxxxx>

Current Thread