Skip to content

Commit

Permalink
feat(objectionary#834): add indexes for vars-float-down.xsl
Browse files Browse the repository at this point in the history
  • Loading branch information
volodya-lombrozo committed Nov 11, 2024
1 parent 4db9b30 commit 51edcf0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,9 @@ private static XML unroll(final XML parsed) {
new TrClasspath<Shift>(
"/org/eolang/parser/remove-cuts.xsl"
).back()
)
),
CanonicalXmir.class,
20
)
).pass(parsed);
}
Expand Down
9 changes: 6 additions & 3 deletions src/main/resources/org/eolang/parser/vars-float-down.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,20 @@ SOFTWARE.
...
<o line="22" base="xyz" name="hello"/>
To achieve the right result, the transformation must be applied a several times.
To achieve the right result, the transformation must be applied several times.
-->
<xsl:output encoding="UTF-8" method="xml"/>

<xsl:key name="o-by-line" match="o" use="@line"/>

<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="//o[@ref and @ref!='' and not(ancestor::o[@ref])]">
<xsl:template match="o[@ref and @ref!='' and not(ancestor::o[@ref])]">
<xsl:variable name="reference" select="@ref"/>
<xsl:variable name="found" select="//o[@line=$reference]"/>
<xsl:variable name="found" select="key('o-by-line', $reference)"/>
<xsl:element name="o">
<xsl:for-each select="$found/@*[name()!='cut']">
<xsl:attribute name="{name()}">
Expand Down

0 comments on commit 51edcf0

Please sign in to comment.