Specific elements at header
This is an open discussion with 8 replies, filed under XSLT.
Search
On the front end?
@czheng Exactly. In my case, I’m using the master.xsl
template for all pages.
In your master template:
<xsl:apply-templates select="data" mode="assets"/>
In each page’s template:
<xsl:template match="data" mode="assets"> <link rel="stylesheet" href="path-to-stylesheet" media="screen" type="text/css" /> </xsl:template>
I thought that were too hard to solve it. Simple and elegant solution. Thanks!
Just out of curiosity, Do you see another way to solve it?
@czheng I have to declare that template on all pages?
Do you see another way to solve it?
Nothing as simple, no.
I have to declare that template on all pages?
Only the pages that need special assets in the header.
I have to declare that template on all pages?
Only the pages that need special assets in the header.
For all the others, who don’t need custom header elements, you can create one in your master.xsl.
It works. Thanks for helping!
Create an account or sign in to comment.
Hello,
I want to insert specific elements such as
script
andlink
to thehead
element on different pages. I don’t want to use all javascripts and stylesheets to all pages.Is that possible?
Thanks in advance!