[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: xsl:for or xsl:repeat
At 04:06 PM 5/24/2006, Jon wrote:
On 5/24/06, Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> wrote:At 01:21 PM 5/24/2006, I wrote: >This is all true, but there are times when <xsl:for-each >select="//node(position() <= $number)"/> is just so far within >the safety zone that a purist solution seems, well, limiting in its >own way (since then we end up having to document the recursion, etc.). It's not a stupid question; nor is it particularly quick. The quick answer is "you're hosed". The deeper answer is "but you're careful to avoid that aren't you?", which raises all kinds of interesting other questions, such as how can you do that and what form your edge cases might take. Compared to a true native solution such as recursion, such a workaround is only a brute-force expediency. Yet those are neither very uncommon, nor necessarily pernicious in themselves, especially when they work. (They can still be bad for other reasons.) As I said earlier, the true solution is to use XSLT in a way that reflects its strengths. Maybe it's not possible to provide, at runtime, secondary input like <signers> <signed/> <signed/> </signed> instead of '2'. But if it is, then XSLT has a much more elegant solution to the problem of knowing how many times to iterate: for-each select="$signers/*". If you know the names of the signers ahead: <signers> <signed>Geo Washington, Esq</signed> <signed>Dr B Franklin</signed> </signers> you could even print their names on the form (though I'm not sure you'd want to) under the blanks where they are meant to sign. Knowing ahead of time what their names are might be only a bit more of a stretch than knowing how many there are. Mind you, as was mentioned, this all disappears in XSLT/XPath 2.0, which can iterate over the sequence (1 to $n). Cheers, Wendell ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
|
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
|