Subject: Re: [xsl] constructing arrays in XSLT with templates From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Fri, 18 Jun 2021 18:44:46 -0000 |
Hi fellow XSLT enthusiasts,
I've been constructingB json in XSLT using xsl:map and xsl:map-entry and the resulting code looks really nice.B But I'm a bit stuck with arrays and was hoping for some enlightenment.
Within the template for "/books" I find that I have to declare a variable in order to represent the sequence of maps that come from the nested apply-templates.
I'd like to be able to do away with the intermediate $books variable which is used for the purpose of constructing the array using the xpath "array { ... }" expression.
Is there a more elegant way of doing this?
With Saxon PE and EE there is an extension instruction saxon:array you can use.
But in pure XSLT 3 you need some way to work around the lack of that instruction so your variable or a function that then does apply-templates are needed for the general, recursive approach.
Of course for the limited sample you could be tempted to inline anything as an XPath 3.1 expression.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] constructing arrays in XSLT w, Alan Painter alan.pa | Thread | Re: [xsl] constructing arrays in XS, Martin Honnen martin |
[xsl] constructing arrays in XSLT w, Alan Painter alan.pa | Date | Re: [xsl] constructing arrays in XS, Martin Honnen martin |
Month |