[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: request for help resolving ambiguous rule match
At 2008-11-24 11:03 -0500, John A. Walsh wrote:
In my xml (TEI P5 documents), I have structures like this: ... 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>.
You have an ambiguity, and it sounds like both conditions need to be there, but the question is, do you want only one or both to "fire" when the node is sent to your stylesheet? On the one you want to fire first or only, add priority="1" to the template rule. If you want both to fire, then add the priority as above and inside that first template rule, instead of using <xsl:apply-templates/>, in XSLT 2.0 use <xsl:next-match/> and then the processor will review all matching templates *except* the one that just matched and will invoke the second one. So, as you can see, it is up to the stylesheet write to distinguish the template rules by using the priority attribute. Many stylesheets don't use priority because the shape of the match pattern governs a default value for priority, where anything more complex than a simple name has the same priority value of ".5" (after all, the processor can't decide for you which of two different patterns more complex than a simple name has higher priority than the other). There are other implicit layers of priority described in the specification and in training materials. In many simple stylesheets the implicit priority suffices. I hope this helps. . . . . . . . . . . Ken -- Upcoming XSLT/XSL-FO, UBL and code list hands-on training classes: : Sydney, AU 2009-01/02; Brussels, BE 2009-03; Prague, CZ 2009-03 Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video sample lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg Video course overview: http://www.youtube.com/watch?v=VTiodiij6gE G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|