Re: Processiing arrays in XSLT 4

On Sat, Jan 9, 2021 at 9:39 AM Michael Kay <mike@saxonica.com> wrote:

> >
> > Why not just:
> >
> > <xsl:array select ="{expressionProducingAnArray}"/>
> >
>
>
> Constructing an array when you need to invoke xsl:apply-templates as part
> of the array construction is very inconvenient at present, and that's a
> common requirement when transforming XML to JSON.
>
> Also, there's no easy way in XPath of constructing a completely general
> array: the [...] constructor only works if the size of the array is known
> statically, and the array{...} constructor only works if each member of the
> array is a singleton.
>

Then something like this:

<xsl:array member-constructor="{  Function taking an xs:integer as argument
and producing item()*  }"/>

And with risk to open a can of worms here, why not (just the new of the
attribute!):

<xsl:array member-generator="{  Function (generator)  taking an xs:integer
as argument and producing item()*  }"/>

Thanks,
Dimitre

On Sat, Jan 9, 2021 at 9:58 AM Dimitre Novatchev <dnovatchev@gmail.com>
wrote:

>
>
> On Sat, Jan 9, 2021 at 9:39 AM Michael Kay <mike@saxonica.com> wrote:
>
>> >
>> > Why not just:
>> >
>> > <xsl:array select ="{expressionProducingAnArray}"/>
>> >
>>
>>
>> Constructing an array when you need to invoke xsl:apply-templates as part
>> of the array construction is very inconvenient at present, and that's a
>> common requirement when transforming XML to JSON.
>>
>> Also, there's no easy way in XPath of constructing a completely general
>> array: the [...] constructor only works if the size of the array is known
>> statically, and the array{...} constructor only works if each member of the
>> array is a singleton.
>>
>
> Then something like this:
>
> <xsl:array member-constructor="{  Function taking an xs:integer as
> argument and producing item()*  }"/>
>
> Thanks,
> Dimitre
>
>
>
>> Michael Kay
>> Saxonica
>
>
>
> --
> Cheers,
> Dimitre Novatchev
> ---------------------------------------
> Truly great madness cannot be achieved without significant intelligence.
> ---------------------------------------
> To invent, you need a good imagination and a pile of junk
> -------------------------------------
> Never fight an inanimate object
> -------------------------------------
> To avoid situations in which you might make mistakes may be the
> biggest mistake of all
> ------------------------------------
> Quality means doing it right when no one is looking.
> -------------------------------------
> You've achieved success in your field when you don't know whether what
> you're doing is work or play
> -------------------------------------
> To achieve the impossible dream, try going to sleep.
> -------------------------------------
> Facts do not cease to exist because they are ignored.
> -------------------------------------
> Typing monkeys will write all Shakespeare's works in 200yrs.Will they
> write all patents, too? :)
> -------------------------------------
> Sanity is madness put to good use.
> -------------------------------------
> I finally figured out the only reason to be alive is to enjoy it.
>
>


-- 
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
To avoid situations in which you might make mistakes may be the
biggest mistake of all
------------------------------------
Quality means doing it right when no one is looking.
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
-------------------------------------
To achieve the impossible dream, try going to sleep.
-------------------------------------
Facts do not cease to exist because they are ignored.
-------------------------------------
Typing monkeys will write all Shakespeare's works in 200yrs.Will they write
all patents, too? :)
-------------------------------------
Sanity is madness put to good use.
-------------------------------------
I finally figured out the only reason to be alive is to enjoy it.

Received on Saturday, 9 January 2021 19:15:37 UTC