[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
more stylesheet fun
- From: Paul Heinlein <heinlein cse ogi edu>
- To: rpm-list redhat com
- Subject: more stylesheet fun
- Date: Wed, 21 Jan 2004 16:27:07 -0800 (PST)
Try running the stylesheet below for an all-in-one look at
install-time (or yum-time) package groups.
Sample output: http://www.cse.ogi.edu/~heinlein/comps.html
If you save the stylesheet as, say, comps2html.xsl, then invocation is
simple:
xsltproc -o comps.html --novalid comps2html.xsl comps.xml
-- Paul Heinlein <heinlein@cse.ogi.edu>
<?xml version='1.0'?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<xsl:stylesheet version="1.0"
mlns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"
indent="yes"
encoding="iso-8859-1"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>
<!-- the main event -->
<xsl:template match="comps">
<html lang="en-US">
<head>
<title>comps.xml</title>
<xsl:call-template name="default.css"/>
</head>
<body>
<xsl:call-template name="intro.text"/>
<table width="95%">
<tr>
<th>Name</th>
<th>Default</th>
<th>Visible</th>
<th>Description</th>
</tr>
<xsl:apply-templates select="group" mode="group.chart"/>
</table>
<p> </p>
<table width="95%">
<tr>
<th>Name</th>
<th>Groups Req.</th>
<th>Packages Req.</th>
</tr>
<xsl:apply-templates select="group" mode="package.chart"/>
</table>
</body>
</html>
</xsl:template>
<!-- for listing descriptions, whether group is default, ... -->
<xsl:template match="group" mode="group.chart">
<xsl:variable name="id" select="id"/>
<tr>
<td id="{$id}-info">
<a href="#{$id}-detail"><xsl:value-of select="name"/></a>
</td>
<td><xsl:value-of select="default"/> </td>
<td><xsl:value-of select="uservisible"/> </td>
<td><xsl:value-of select="description"/> </td>
</tr>
</xsl:template>
<!-- for listing groups and packages req. by this group -->
<xsl:template match="group" mode="package.chart">
<xsl:variable name="id" select="id"/>
<tr>
<td id="{$id}-detail">
<a href="#{$id}-info"><xsl:value-of select="name"/></a>
</td>
<td><xsl:apply-templates select="grouplist"/></td>
<td><xsl:apply-templates select="packagelist"/></td>
</tr>
</xsl:template>
<!-- templates for grouplist and children -->
<xsl:template match="grouplist">
<table width="100%">
<xsl:apply-templates select="*" mode="html.table"/>
</table>
</xsl:template>
<xsl:template match="groupreq" mode="html.table">
<tr>
<xsl:call-template name="sub.table.row">
<xsl:with-param name="leftcol" select="."/>
<xsl:with-param name="rightcol" select="' '"/>
</xsl:call-template>
</tr>
</xsl:template>
<xsl:template match="metapkg" mode="html.table">
<tr>
<xsl:call-template name="sub.table.row">
<xsl:with-param name="leftcol" select="."/>
<xsl:with-param name="rightcol" select="@type"/>
</xsl:call-template>
</tr>
</xsl:template>
<!-- templates for packagelist and children -->
<xsl:template match="packagelist">
<table width="100%">
<xsl:apply-templates select="*" mode="html.table"/>
</table>
</xsl:template>
<xsl:template match="packagereq" mode="html.table">
<tr>
<xsl:call-template name="sub.table.row">
<xsl:with-param name="leftcol" select="."/>
<xsl:with-param name="rightcol" select="@type"/>
</xsl:call-template>
</tr>
</xsl:template>
<!-- named templates -->
<xsl:template name="sub.table.row">
<xsl:param name="leftcol"/>
<xsl:param name="rightcol"/>
<xsl:variable name="last">
<xsl:choose>
<xsl:when test="position() = last()">1</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="$last = '1'">
<td style="border-style: none;"><xsl:value-of select="$leftcol"/></td>
<td style="border-style: none; text-align: right;">
<xsl:value-of select="$rightcol"/>
</td>
</xsl:when>
<xsl:otherwise>
<td><xsl:value-of select="$leftcol"/></td>
<td style="text-align: right;"><xsl:value-of select="$rightcol"/></td>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="default.css">
<xsl:variable name="color" select="'#990000'"/>
<style type="text/css">
a, a:link, a:active, a:visited {
color: <xsl:value-of select="$color"/>;
}
body {
font-size: small;
background-color: white;
color: black;
width: 700px;
}
td {
border-bottom: 1px solid #999;
font-size: small;
vertical-align: top;
}
th {
color: white;
background-color: <xsl:value-of select="$color"/>;
font-weight: bold;
text-align: left;
padding-right: 15px;
}
</style>
</xsl:template>
<xsl:template name="intro.text">
<p>
Below is an outline of the package groups available at installation
and, later, via yum and other package-management tools. The top
table contains descriptions of each group. To see a detailed view
of the packages that get installed with each group, click on the
group name.
</p>
</xsl:template>
</xsl:stylesheet>
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]