xsl-list
[Top] [All Lists]

Re: [xsl] XSLT 4 xsl:with

2020-05-20 23:17:45
On Tue, May 19, 2020 at 06:10:56PM -0000, Wendell Piez 
wapiez(_at_)wendellpiez(_dot_)com scripsit:
Does anyone else find themselves doing

<xsl:for-each-group select="some-node" group-by="true()">
   .... inside I have current-group() ...
</xsl:for-each-group>

-- which has sometimes made me wonder if group-by="true()" might be a
default on for-each-group?

Or ... would <xsl:with>...</xsl:with> or <xsl:for>...</xsl:for> or
<xsl:at>...</xsl:at> be a serviceable and better way to do this as
well?

Wouldn't the equivalent be

<xsl:with-context select="some-node">
    ... stuff happens...
</xsl:with-context>

Using for-each-group gives you a sequence in current-group(); I would think 
that if you expect a sequence, you might-maybe be better to use xsl:for-each 
rather than xsl:with-context.  If I understood the original idea, it was a way 
to be less confusing by not using xsl:for-each in the singleton case.

If we were to allow modes on xsl:with-context, it'd be a way to do mode-based 
selection.

-- 
Graydon Saunders  | graydonish(_at_)gmail(_dot_)com
Þæs oferéode, ðisses swá mæg.
-- Deor  ("That passed, so may this.")
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>