xsl-list
[Top] [All Lists]

AW: [xsl] Basic Question about Adding Styles to XSL

2006-07-11 07:30:51
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(_at_)lemoyne(_dot_)edu]
Gesendet: Dienstag, 11. Juli 2006 16:18
An: XSL-LIST
Betreff: [xsl] 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(_at_)lemoyne(_dot_)edu


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>
  • AW: [xsl] Basic Question about Adding Styles to XSL, Huditsch, Roman \(LNG-VIE\) <=