I am modifying a XSL that already come with some templates outputting data relative to the current context node. I want to call the same templates with a different context so I don't have to change the existing templates by passing additional parameters.
for example XML:
<anyRoot>
<level1>
<a>xxxxxx</a>
<b>yyyyyy</b>
<level2>
<a>aaaaa</a>
<b>bbbbbb</b>
<c>cccccc</c>
<d>dddddd</d>
</level2>
</level1>
<level1>
<a>zzzzzz</a>
<b>jjjjjj</b>
<level2>
<a>nnnnn</a>
<b>bbbbbb</b>
<c>cccccc</c>
<d>dddddd</d>
</level2>
</level1>
</anyRoot>
Theoretical XSL. Note that the "context=" attribute is invalid but I put it there to explain my idea:
...
<xsl:for-each select="/anyRoot/level1/level2">
<xsl:call-template name="testTmplate"/>
<xsl:call-template name="testTmplate" context=".."/> <!-- passing parent of level2-->
</xsl:for-each>
...
<xsl:template name="testTmplate">
<xsl:value-of select="./a"/>
</xsl:template>
This is what I want to see as output:
aaaaa
xxxxxxx
nnnnnnn
zzzzzzz