[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: streaming XSLT creating a header from a first reco
On 08.05.2018 17:33, Martin Honnen martin.honnen@xxxxxx wrote:
On 08.05.2018 17:19, Geert Bormans geert@xxxxxxxxxxxxxxxxxxx wrote:All, Hm, I forgot that you can't have positional predicates in a streamable match pattern so it seems you first need to set up an additional accumulator counting the rows and then to make sure the other accumulator only stores the attribute values for the first row. Additionally I had the wrong map type, so <xsl:mode streamable="yes" on-no-match="shallow-copy" use-accumulators="#all"/> <xsl:accumulator name="row-count" as="xs:integer" streamable="yes" initial-value="0"> <xsl:accumulator-rule match="table/row" select="$value + 1"/> </xsl:accumulator> <xsl:accumulator name="first-row-values" as="map(xs:QName, xs:string)" initial-value="map{}" streamable="yes"> <xsl:accumulator-rule match="table/row" select="if (accumulator-before('row-count') eq 1) then map:merge(@*!map { node-name() : string(.) }) else $value"/> </xsl:accumulator> should work better. Only drawback is that maps don't preserve the order of entries although as the data comes from XML attributes which aren't ordered either that might not matter.
|
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
|