It seems as if I can’t use an Xpath in the name attribute of the call-template element. How can I get around this? Any help/thoughts would be awesome!
<xsl:for-each select="child::knomaddb/Content/Videos">
<xsl:result-document method="xhtml" href="{local-name()}.html">
<html>
<body>
<h1>Knomad</h1>
<h2>{local-name()} Videos</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Title</th>
<th>Video</th>
<th>Description</th>
<th>Comments</th>
</tr>
<xsl:for-each select="Video">
<xsl:call-template name="{ancestor::local-name()}"/>
</xsl:for-each>
</table>
</body>
</html>
</xsl:result-document>
</xsl:for-each>
Good question, +1.
You can’t. But you can use instead
<xsl:apply-templates>.Here is a quick demo:
When this transformation is applied on any XML document (not used), the wanted result is produced:
Do note:
One can pass as parameter (the first argument) to
my:apply()any “function” andmy:apply()will apply it to its second argument.Using this same principle the FXSL library implemented Higher Order Functions (HOFs) in XSLT 1.0 and XSLT 2.0 — read more here.
In the forthcoming XPath 3.0 functions are for the first time first class objects in the Xpath Data Model (XDM).