This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 22127 - Allow xsl:next-match inside xsl:for-each
Summary: Allow xsl:next-match inside xsl:for-each
Status: CLOSED WONTFIX
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 3.0 (show other bugs)
Version: Working drafts
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-21 21:41 UTC by Evan Lenz
Modified: 2014-05-15 14:00 UTC (History)
0 users

See Also:


Attachments

Description Evan Lenz 2013-05-21 21:41:46 UTC
I've tried this on a couple of occasions but was disappointed to see that it didn't work. I understand that the semantics need some defining, but from the user's perspective there's only one behavior that makes sense: run the next-match based on the node that was matched (which may not be the current node if inside xsl:for-each). Call it the "currently matched node" if necessary. I don't believe it would make sense to say "next-match" on any other node (such as the current node), because there would no longer be a comparison by which another match could be said to be "next"; my point here is that there's no ambiguity problem.

It can be useful for "fanning out" the matched node, where the first match does the fanning and the next match does the processing, all in the same mode. That it's a next match (in the same mode) rather than using a new mode is important because the first-matching template rule could be associated with more than one mode (to support multiple fanning scenarios, for example). Also, you may want to pass a different parameter for each <xsl:for-each> iteration.

My contention is that xsl:next-match (and xsl:apply-imports) should not be defined in terms of the current node but rather the currently matched node, thereby removing the restriction; and that <xsl:for-each> shouldn't nullify the current template rule.

Evan
Comment 1 Michael Kay 2013-05-21 22:30:41 UTC
I'd like to see a compelling use case. 

My instincts are against adding more "current this" and "current that" values; even if scoped statically to a template rule, they add semantic complexity. For example, this facility would complicate the streamability rules. If we did introduce a "current matched node" I think we would need an interrogative function to return it. (In practice, I suspect this new function would then be used a lot more than the proposed xsl:next-match facility...)
Comment 2 Michael Kay 2013-07-31 15:51:30 UTC
The WG reviewed this and decided that in the absence of a compelling use case the WG was inclined to make no change in this area.

Unless we have further input before 1 September we will close this with no action.