473,606 Members | 3,113 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Inserting a variable in a stylesheet.

I am in the process of converting a page with nested tables to CSS. The
current page is at http://www.douglaidlaw.net./boykett/history.html. So
far, it is using a page-wide stylesheet to set fonts only.

I want this page to be followed by others with identical layout for
successive "chapters." In each page, I would like a different image to
replace the overworked silhouette. For example, in the next page, I would
like to have photos of Thomas' office building, then and now. So they will
be not only different from Page 1, but different from each other.

How can I handle that with a stylesheet? Rather than do away with tables
altogether, as a first stage, I would prefer to move the table structure to
a site-wide stylesheet. All pages use the same basic structure. I would
need something like IMG1 and IMG2 in the stylesheet, and the URLs stated in
the individual page.

Thanks,

Doug
--
Registered Linux User No. 277548. My true email address has hotkey for
myaccess.
Never let your sense of morals get in the way of doing what's right.
- Isaac Asimov.

Jan 12 '06 #1
3 1387

Doug Laidlaw wrote:
In each page, I would like a different image to
replace the overworked silhouette. How can I handle that with a stylesheet?


If you have server-side scripting (e.g. PHP or Perl or JSP or ASP)
available then you could generate stylesheets dynamically, for instance
passing in the image URL in the query string e.g.
<link rel="stylesheet "
type="text/css"
href="styleshee t.php?img=image 1.gif">
and then generating the CSS you want to serve.

There is nothing you could do directly in a static stylesheet as CSS
does not allow you to have variables which a user agent would substitute
as needed.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 12 '06 #2
On Thu, 12 Jan 2006 14:52:28 +1100, Doug Laidlaw
<la******@myacc ess.com.au> wrote:
I want this page to be followed by others with identical layout for
successive "chapters." In each page, I would like a different image to
replace the overworked silhouette.


You need to apply different fragments of a stylesheet to each group of
pages.

There are two ways to do this - take your pick.

One is to have n+1 stylesheets. Each page links in the "common"
stylesheet, then after that links in the appropriate "chapter"
stylesheet. The chapter stylesheet has only the chapter-specific changes
in it (for robustness, these over-write a safe default that's in the
common stylesheet anyway).

The other way is to have one stylesheet and to give each page a class on
the <body> tag of "chapter1" etc. Then use this in a selector in a
repeated group of similar rules in the common stylesheeet, changign the
value as necessary.

Don't do dynamic things - this isn't a dynamic site. It's easier to do
it as a one-off publishing task, rather than a repeated page-serving
task.
Jan 13 '06 #3
Martin Honnen wrote:

Doug Laidlaw wrote:
In each page, I would like a different image to
replace the overworked silhouette.

How can I handle that with a stylesheet?


If you have server-side scripting (e.g. PHP or Perl or JSP or ASP)
available then you could generate stylesheets dynamically, for instance
passing in the image URL in the query string e.g.
<link rel="stylesheet "
type="text/css"
href="styleshee t.php?img=image 1.gif">
and then generating the CSS you want to serve.

There is nothing you could do directly in a static stylesheet as CSS
does not allow you to have variables which a user agent would substitute
as needed.


Thank you, Martin. Yes, I do have PHP. The family tree program itself is
written in PHP. I suppose that I could just leave the image to be put
there by HTML, in a similar fashion to the text block, but I haven't
thought it through.

Doug.
--
Registered Linux User No. 277548. My true email address has hotkey for
myaccess.
No man was ever endowed with a right without being at the same time saddled
with a responsibility.
- Gerald W. Johnson.

Jan 13 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3200
by: Dennis Westermann | last post by:
I have the following problem XML-File: <SEARCH> <TAG>'x' or 'y'</TAG> </SEARCH> <CHARLIST> <CHAR>a</CHAR> <CHAR>x</CHAR>
1
2274
by: CB | last post by:
I have a group of documents that previously had no schema, now I have a schema, and I want to use XSLT to fixup the documents by inserting the namespace reference. In other words, my input document looks like <SiteAdaptationFile> ... </SiteAdaptationFile>
5
4120
by: Nagi Peters | last post by:
Hello I try to tranform a XML Document in php/Sablotron with the following XSL Stylesheet. I tried to write "@id='1'" with the variable chapter_id. So it works: <xsl:variable name="chapter_id">1</xsl:variable> <xsl:template match="chapter"> snipp..
2
1533
by: Bradford | last post by:
Question for the masses... Lets say I have variable with the following contents "aaaa bbbb ccccc dddd". The format is not specific and the space delimiter could be changed to any other. How would i count and/or select the nodes where a child nodes value is not contained in this list. Or the reverse scenario would be sufficent whereas I count the nodes whose child nodes value is contained.
4
3236
by: Frederik Sørensen | last post by:
I include a xslt stylesheet with variables for all the error messages in my system. <xsl:variable name="Banner_error_1"> errormessage 1 for banner </xsl:variable> <xsl:variable name="Banner_error_2"> errormessage 2 for banner </xsl:variable>
2
1277
by: John | last post by:
I'm new to XSLT and I've been trying to figure out a solution for the last couple of days. The XML & XSLT stylesheet are below. Basically I want to declare some language (English, French, etc.) variables at the beginning of the stylesheet, however I keep getting variable scope errors. The language strings are specific to this template. There aren't many since most of the data is coming from an application through XML. Below is a...
1
3091
by: MC | last post by:
Hi to all, I would like to use in a XSL stylesheet an array variable which is defined in a Java program. For example, in my program, i defined a tab variable String tab = {"first", "second", "third"}; which i pass to the XSLT processor like this : transform.setParameter("tab", tab);
2
1836
by: Jon Martin Solaas | last post by:
Hi, I have a general document somewhat like this: -------------------------------------- <root> <level1> <level2> <interestingstuff number="2"/> <interestingstuff number="3"/> <interestingstuff number="1"/>
6
14187
by: Jody Gelowitz | last post by:
I have run into an issue with variable scope within an XSLT document that is translated in VS.NET 2.0. Under VS.NET 1.1 (XslTransform), this code works fine. However, when using VS.NET 2.0 (XslCompiledTransform), the exact same XSLT transformation fails with the error: System.Xml.Xsl.XslLoadException: The variable or parameter 'lastrecordwaskit' was duplicated within the same scope. An error occurred at (174,12). at...
0
8036
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8126
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8317
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6796
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5987
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5470
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4010
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1572
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1313
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.