I have a problem and I need you.
I had an idea to solve it with the following code:
<xsl:template match="root">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="*[@foo]" priority="3">
<p>This text must be systematically added for any rendered element having a foo attribute</p>
<xsl:apply-templates select="."/>
</xsl:template>
<xsl:template match="bar1">
<p>This is the normal rendering for the bar1 element</p>
</xsl:template>
<xsl:template match="bar1[@class='1']">
<p>This is the normal rendering for the bar1 element with class 1</p>
</xsl:template>
<xsl:template match="bar1[@class='2']">
<p>This is the normal rendering for the bar1 element with class 2</p>
</xsl:template>
...
<xsl:template match="barN">
<p>This is the normal rendering for the barN element</p>
</xsl:template>
When I try to apply this xsl on the following xml:
<root>
<bar1 foo="1"></bar1>
<bar1 foo="1" class="1"></bar1>
<bar1 class="2"></bar1>
<bar1></bar1>
...
<barN foo="n"></barN>
<barN></barN>
</root>
The XSLT engine loops endlessly on the priority="3" template instead of (for my need) applying first the priority="3" template once and then applying the bar1 .. barN templates.
How can I perform this without modifying each of the bar1 .. barN templates (N~=150) to add the systematic text on each element having a foo attribute?