July 27, 2024

I said in my last post that I would show how to call CSS in our gallery. Normally when we call a CSS file we would use the standard call tag:

As per my last post, note the trailing ‘/’ which closes the link tag.

This seems to work fine as a call inside transformer.xslt on mac but causes issues on PC. Therefore we need a correct way to call our file that works on both. Here’s some sample code from the ‘RollOver’ gallery I’ve working (not completed yet-I still can’t get the first image preloaded!). This part shows the initial calls defining the Paths and the then head section, where I use to call the code to add the CSS link.








<xsl:value-of select="$siteTitle"></xsl:value-of>





The is just there to call the javascript for this particular gallery and not needed for the CSS call. I’ve left it in for completeness in relation to the gallery I’m doing this call on.

The xsl:template that is being called to make this happen is below:







You place this code below the of the ‘index.html’ template call and above the at the end of the file. The call to ‘scrollextra.css’ is simply the filename of the CSS I’m using in this gallery.
Again hope this helps.

2 thoughts on “Calling a CSS file: the XSLT way.

  1. href=”/test/common/css/common.css” in link tag

    This work fine in all browsers but in mac causes issues on PC.

    Can you please help me i am working on xml using xslt in .net

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Verified by MonsterInsights