473,387 Members | 3,684 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Linking to a separate CSS in XSL

I am a newbie in using XSL to transform my XML documents into HTML.
Let's say I have an XML like this:

foo.xml:
--------

<?xml version="1.0" ?>
<?xml:stylesheet type="text/xsl" href="foo.xsl"?>

<root>

<element>
<name>Brian</name>
<email>br***@foo.com</email>
</element>

<element>
<name>Jeff</name>
<email>je**@foo.com</email>
</element>
..
..
</root>
Now I'd like to convert my XML data into a HTML table, by using the XSL.
The basic trick I can handle:
foo.xsl:
--------

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">

<html>

<head>
<title>My contacts</title>
</head>

<body>
<h1>All of my contacts in one huge table</h1>
<p>
An ordinary paragraph of text.
</p>
<table border="1">
<tr>
<td>Name</td>
<td>E-mail address</td>
</tr>
<xsl:for-each select="root/element">
<tr>
<td><xsl:value-of select="name"/></td>
<td><xsl:value-of select="email"/></td>
</tr>
</xsl:for-each>
</table>
</body>

</html>

</xsl:template>
</xsl:stylesheet>
Question: what if I want to format the HTML table created by a separate
CSS file, say "my_style.css"? That file includes the normal CSS style
definitions like
my_style.css:
-------------

p,table,li,h1,h2,h3
{
font-family: verdana, arial, 'sans serif';
}

p, h1, h2, h3, table, li, hr
{
margin-left: 10pt;
}

p,li,th,td
{
font-size: 75%;
}
Where in my XSL can I put the link to a separate CSS, to take all of that
style formatting into use in my XSL-generated HTML table? Or is there
some other mechanism for that in XSL?
Jul 20 '05 #1
4 3506
"Jyrki Keisala" <zo****@jippii.fi> wrote in message
news:Xn****************************@131.228.6.99.. .
[...]
Now I'd like to convert my XML data into a HTML table, by using the XSL.
The basic trick I can handle:
foo.xsl:
--------

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">

<html>

<head>
<title>My contacts</title>
Add <link rel="stylesheet" type="text/css" href="my_style.css"/> here.

</head>
<body/>
</html>

</xsl:template>
</xsl:stylesheet>
Question: what if I want to format the HTML table created by a separate
CSS file, say "my_style.css"? That file includes the normal CSS style
definitions like


See above. The idea is that the output HTML document refers to the
stylesheet.

Groetjes,
Maarten Wiltink
Jul 20 '05 #2
"Maarten Wiltink" <ma*****@kittensandcats.net> wrote in
news:3f*********************@news.xs4all.nl:
"Jyrki Keisala" <zo****@jippii.fi> wrote in message
news:Xn****************************@131.228.6.99.. .
[...]
Now I'd like to convert my XML data into a HTML table, by using the
XSL. The basic trick I can handle:
foo.xsl:
--------

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">

<html>

<head>
<title>My contacts</title>


Add <link rel="stylesheet" type="text/css" href="my_style.css"/> here.

</head>


<body/>
</html>

</xsl:template>
</xsl:stylesheet>
Question: what if I want to format the HTML table created by a
separate CSS file, say "my_style.css"? That file includes the normal
CSS style definitions like


See above. The idea is that the output HTML document refers to the
stylesheet.

Groetjes,
Maarten Wiltink


Are you actually using that trick? I tried to do just that, but got an
error message from the IE.
Jul 20 '05 #3


Jyrki Keisala wrote:
I am a newbie in using XSL to transform my XML documents into HTML. foo.xsl:
--------

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">


Are you sure you want that namespace http://www.w3.org/TR/WD-xsl?
The correct namespace for XSLT 1.0 is http://www.w3.org/1999/XSL/Transform.
Only older IE versions should support http://www.w3.org/TR/WD-xsl but
the language defined by that namespace is different from XSLT 1.0.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #4


Jyrki Keisala wrote:
"Maarten Wiltink" <ma*****@kittensandcats.net> wrote in
news:3f*********************@news.xs4all.nl:

"Jyrki Keisala" <zo****@jippii.fi> wrote in message
news:Xn****************************@131.228.6.99 ...
[...]
Now I'd like to convert my XML data into a HTML table, by using the
XSL. The basic trick I can handle:
foo.xsl:
--------

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">

<html>

<head>
<title>My contacts</title>


Add <link rel="stylesheet" type="text/css" href="my_style.css"/> here.
</head>


<body/>
</html>

</xsl:template>
</xsl:stylesheet>
Question: what if I want to format the HTML table created by a
separate CSS file, say "my_style.css"? That file includes the normal
CSS style definitions like


See above. The idea is that the output HTML document refers to the
stylesheet.

Groetjes,
Maarten Wiltink

Are you actually using that trick? I tried to do just that, but got an
error message from the IE.


Which error message?
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #5

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

Similar topics

20
by: Steven T. Hatton | last post by:
I just read this in the description of how C++ is supposed to be implemented: "All external object and function references are resolved. Library components are linked to satisfy external...
2
by: TheTamdino | last post by:
One of the things that is common between most genealogy databases is that they will have one screen were you log all the information for a given person and then (maybe) have a link to a source...
11
by: dskillingstad | last post by:
I've been struggling with this problem for some time and have tried multiple solutions with no luck. Let me start with, I'm a novice at Access and I'm not looking for someones help to design my...
1
by: Peetah_junkmail | last post by:
Hi, I'm not sure this is completely a C related question since it's more about linking problems, so don't hesitate to redirect me to a more appropriate NG. I have a set of useful functions...
4
by: Gary Hughes | last post by:
Hi all, sometime I posted a problem in here where I was getting the following error from the linker in VS C++ 2003. Linking... GCClass.obj : error LNK2022: metadata operation failed (80131188)...
2
by: Ciko | last post by:
Still not clear to me: why whe use <stdio.h> I haven't link stdio library (in linking stage) while if I use something of <math.h> I must link this library? Thanks in advance.
3
by: walkeraj | last post by:
I'm trying to compile an open source game called IVAN , and I'm able to compile it from a makefile, but not from an IDE. I have attempted to recreate the way the makefile compiles the project as...
3
by: BASSPU03 | last post by:
(I'm using Access 2003 on a Windows XP O/S.) I have four tables that are related in the following order: tblFiscalYear > tblBulkObligations > tblProjects > tblResources These are their...
4
deephill
by: deephill | last post by:
hi i need different linking and different style in Javascript. Ex: content='<br><big><b>Products</b><br></big><br>Link1 | Link2 | Link3' I need separate styles for Products and Links and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...

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.