[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Count of template matches

Subject: Count of template matches
From: "Wolfgang Laun wolfgang.laun@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 4 Nov 2014 11:27:54 -0000
 Count of template matches
A recent post has asked for a way to produce ordinals for the processing of
a set of certain nodes.

If you construct a sequence of the required nodes and iterate it (using
for-each), position() yields the ordinals.

If you use template/apply-templates. you can still determine the offset by
calling index-of. But this has a catch, since index-of still requires the
construction of the overall sequence using an XPath expression. But (and
this is, for me, the catch) that the selection of the nodes that will
eventually be processed depends on attribute values of template+@match
and/or apply-templates+@select. This means that you need two ways to
produce the same sequence of nodes for index-of to work. (I do know that
XPath is powerful enough. so it's not an issue of not being able to - it's
just duplicating an effort.)

A function like fn:nth-time-around() in the context of a template would
take care of the problem, which (apparently) isn't frequent enough to
warrant such a function.

Perhaps I'm simply ignorant of something?
-W

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.