|
Subject: Re: [xsl] Optimising XSLT 2.0 restructuring of large SVRL files (Saxon-HE 12.9) From: "Graydon graydon@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Fri, 22 May 2026 12:02:24 -0000 |
On Fri, May 22, 2026 at 11:36:44AM +0000, Susanne Wunsch susanne.wunsch@xxxxxxxxxxxxx scripsit: > Hi all, [snip] > Is there an XSLT 2.0 way that produces identical output but avoids the > apparent n^2 cost of the sibling-axis idioms above? https://www.saxonica.com/html/documentation12/xsl-elements/for-each-group.htmlhttps://www.saxonica.com/html/documentation12/xsl-elements/for-each-group.html would be worth a look. Something vaguely like <xsl:for-each-group select="*" group-starting-with="fired-rule"> <xsl:choose> <xsl:when test="current-group()[1] instance of element(fired-rule)"> <xsl:element name="fired-rule"> <xsl:apply-templates select="head(current-group())/@*"/> <xsl:apply-templates select="head(current-group())/node()"/> <xsl:apply-templates select="tail(current-group())"/> </xsl:element> </xsl:when> <xsl:otherwise> <xsl:apply-templates select="current-group()"/> </xsl:otherwise> </xsl:choose> </xsl:for-each-group> (This is entirely untested.) Is the pattern; group starting with fired-rule, replicate that fired rule and put everything after it in the group into it. The same sort of pattern will work for active-pattern but it'll need to be a distinct pass in another mode. Hope that helps! -- Graydon -- Graydon Saunders | graydonish@xxxxxxxxxxxx \xDE\xE6s ofer\xE9ode, \xF0isses sw\xE1 m\xE6g. -- Deor ("That passed, so may this.")
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] Optimising XSLT 2.0 restructu, Susanne Wunsch susan | Thread | Re: [xsl] Optimising XSLT 2.0 restr, Michael Kay mike@xxx |
| [xsl] Optimising XSLT 2.0 restructu, Susanne Wunsch susan | Date | Re: [xsl] Optimising XSLT 2.0 restr, Michael Kay mike@xxx |
| Month |