Reputation: 4056
It seems that my template is never called but the for loop works correctly.
It prints "test" exactly the number of times the "car" node exists but "doStuff" doesn't seem to be accessed and "test2" is never outputted. Any ideas?
<fo:table-body>
<xsl:for-each select="car">
test
<xsl:apply-templates select="car" />
</xsl:for-each>
</fo:table-body>
....
<xsl:template match="car">
<fo:table-row height="0.40cm">
test2
dostuff()....
Upvotes: 3
Views: 529
Reputation: 7456
Within the for-each, "car" is the active node, and since by default the select
attribute on apply-templates
searches the descendants axis, it's trying to select "car" elements that are children of the active car element. Try
<xsl:apply-templates select="."/>
instead.
Upvotes: 4
Reputation: 60276
That's because you're trying to apply a nested car...
The for-each
already changes the context, so that you have to apply the template on the current node:
<xsl:apply-templates select="."/>
Upvotes: 7