not sure if the template can be found in the xml, if it's possible, you'd use /@template instead of /$template (from xslt that is). And even then you'd only get the id of the template.
Sometimes I have used the templateID in my XSLT to determine which template, an array of selected nodes, had. In this way I could do different stuff to the choosen nodes, depending on what templateID was used.
But this could also be achieved by getting the @nodeTypeAlias of the nodes, if i wanted to make the selection by document type. But sometimes the document types can have several different templates. In this way things could easily be messed up.
But back to your question Peter.
You can achieve the templateID by using something like this:
<xsl:value-of select="$currentPage/@template" />
And you can get the document type ALIAS by doing something like this:
Retrieving template/documenttype in xslt
Hi
Is it possible to retrieve the selected template and/or documenttype for a page??
something like umbraco.library:GetXmlNodeById($source)/self::node/$template
documenttypeis in something like nodeTypeAlias attribute
Hi Peter, content nodes contains "nodeType" and "template" attributes directly on the node.
>Tommy
not sure if the template can be found in the xml, if it's possible, you'd use /@template instead of /$template (from xslt that is). And even then you'd only get the id of the template.
Any idea why you'd need the template from xslt?
Cheers,
/Dirk
Sometimes I have used the templateID in my XSLT to determine which template, an array of selected nodes, had. In this way I could do different stuff to the choosen nodes, depending on what templateID was used.
But this could also be achieved by getting the @nodeTypeAlias of the nodes, if i wanted to make the selection by document type. But sometimes the document types can have several different templates. In this way things could easily be messed up.
But back to your question Peter.
You can achieve the templateID by using something like this:
And you can get the document type ALIAS by doing something like this:
Instead of $currentPage, you can of cource use your own source if you want to.
I hope this makes sense to you...
/Kim A
BTW: I think xslt should not be depend on template, which calling it.
Dependancy on documentType is sometimes ok, but you should rather use parameter and modify templates to use this parameter.
Petr
is working on a reply...