Subject: AW: Basic Question about Adding Styles to XSL
From: "Huditsch, Roman \(LNG-VIE\)" <Roman.Huditsch@xxxxxxxxxxxxx>
Date: Tue, 11 Jul 2006 16:30:29 +0200
|
Hi Michelle,
Sure, you can.
Without knowing your input source, I would do something like:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="/">
<xsl:apply-templates select="//guest/name"/>
</xsl:template>
<xsl:template match="name">
<html>
<head>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<div id="mainright">
<div class="sidelinks">Name: <xsl:value-of select="."/><br />
Department: <xsl:apply-templates select="../location"/><br />
Website: <xsl:apply-templates select="../website"/><br />
Email: <xsl:apply-templates select="../email"/><br />
Comment: <xsl:apply-templates select="../comment"/><hr />
</div>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
hope this helps.
best regards,
Roman
> -----Urspr|ngliche Nachricht-----
> Von: Michelle Tarby [mailto:tarbymm@xxxxxxxxxxx]
> Gesendet: Dienstag, 11. Juli 2006 16:18
> An: XSL-LIST
> Betreff: Basic Question about Adding Styles to XSL
>
> This is my first attempt at this, so I want to make sure there's not a
> better way to do it. I'm setting up my XSL stylesheet by incorporating
> my css styles right in it. (If I'm not explaining that well, here's a
> snip)
>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
> <xsl:template match="/">
> <xsl:for-each select="//guest">
> <xsl:apply-templates select="name"/>
> </xsl:for-each>
> </xsl:template>
> <xsl:template match="name">
> <html>
> <head>
> <style type="text/css">
> .sidelinks {
> font-size: 8pt;
> color: #AA7700;
> text-decoration: none
> }
> #mainright {
> position: absolute;
> left: 300px;
> top:145px;
> width:500px;
> font-weight: bold;
> line-height:1.25;
> padding: 10px;
> }
> </style>
> </head>
> <body>
> <div id="mainright">
> <div class="sidelinks">Name: <xsl:value-of select='.'/><br />
> Department: <xsl:apply-templates select="../location"/><br />
> Website: <xsl:apply-templates select="../website"/><br />
> Email: <xsl:apply-templates select="../email"/><br />
> Comment: <xsl:apply-templates select="../comment"/><hr />
> </div>
> </div>
> </body>
> </html>
> </xsl:template>
> </xsl:stylesheet>
>
> My question is - is this the best way to do it? Can I add a link to an
> external style sheet in the XSL?
>
> Thanks in advance!
>
> Michelle
>
> --
> "Every worthwhile accomplishment, big or little, has its stages of
> drudgery and triumph; a beginning, a struggle and a victory."
> --Mahatma Gandhi
>
> *****************************
> Michelle Tarby
> Director of Web Services
> Information Technology
> Le Moyne College
> http://www.lemoyne.edu
> tarbymm@xxxxxxxxxxx
|