Mailinglist Archive: opensuse-doc (5 mails)

< Previous Next >
[opensuse-doc] XSLT question - how to hide some items?
  • From: Christian Boltz <opensuse@xxxxxxxxx>
  • Date: Fri, 21 Nov 2008 21:11:18 +0100
  • Message-id: <200811212111.21507@xxxxxxxxxxxxxxx>

sorry for abusing this list for XSLT questions, but well, some people
here (hello Thomas!) are too good in this area ;-)

I have two small issues with my patch2mail (update notification) script:
It includes two lines at the end of the output which I'd like to

<?xml version="1.0"?>
Daten des Repositorys laden...Installierte Pakete lesen...

The first one is obviously the XML "header", the second one is composed
from two <message type="info">...</message> lines.

The current XSLT file is attached - you can feed it with
zypper --xmlout -t patch | xsltproc patch2mail.xsl -
if you want to test it.

What do I have to change to remove the above lines?
(Note: Only messages with type "info" should be hidden.)


Christian Boltz
Werbung lügt, Corporate Design sagt die Wahrheit. Naja,
alle _guten_ Komponenten der Wahrheit. :-) [Ratti]
<?xml version="1.0" encoding="ISO-8859-15"?>

Copyright (c) 2007 Christian Boltz -

Thanks to Thomas Schraitle for helping with some xslt details.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License (
for more details.


<xsl:stylesheet version="1.1"

<!-- <xsl:output method="text" encoding="ISO-8859-15" media-type="text/plain"
/> -->

<xsl:strip-space elements="*"/>

<xsl:template match="/"><xsl:apply-templates /></xsl:template>

<xsl:template match="update-status">
<xsl:document href="-" method="text" ><xsl:apply-templates />

<!-- errors -->

<xsl:template match="errors"><xsl:apply-templates /></xsl:template>

<xsl:template match="errors/error">
<xsl:text>*** ERROR ***&#10;</xsl:text>
<xsl:apply-templates />

<!-- messages -->

<xsl:template match="message">
<!-- <xsl:if test="@type = 'info'">
<xsl:value-of select="@type"/>:-
<xsl:if test="@type != 'info'">
<xsl:value-of select="@type"/>:
<xsl:apply-templates />

<!-- update sources -->

<xsl:template match="update-sources">
<xsl:text>Update sources:&#10;</xsl:text>
<xsl:apply-templates />

<xsl:template match="update-sources/source">
<xsl:text>- </xsl:text>
<xsl:value-of select="@alias" /> (<xsl:value-of select="@url" />)

<!-- updates -->

<xsl:template match="update-list">
<xsl:apply-templates />

<xsl:template match="update-list/update">
<xsl:if test="@kind = 'patch'">
<xsl:text>&#10;=== </xsl:text>
<xsl:value-of select="@name" />
<xsl:text> - Patch </xsl:text>
<xsl:value-of select="@edition" />
<xsl:text> (</xsl:text>
<xsl:value-of select="@category" />
<xsl:text>) ===&#10;&#10;</xsl:text>
<xsl:apply-templates />

<xsl:template match="update-list/update/summary">
<xsl:apply-templates />

<xsl:template match="update-list/update/description">
<xsl:apply-templates />

<!-- update source of this specific update isn't that interesting ;-) -->
<xsl:template match="update-list/update/source">Update source: <xsl:value-of
select="@alias" /> (<xsl:value-of select="@url" />)</xsl:template>

<!-- summary -->

<xsl:template match="update-summary">

<xsl:text> Total: </xsl:text>
<xsl:value-of select="@total" />
<xsl:text> updates (</xsl:text>
<xsl:value-of select="@security" />
<xsl:text> security)&#10;__TOTAL__</xsl:text>
<xsl:value-of select="@total" /><xsl:value-of select="@security" />

<!-- end -->

< Previous Next >
List Navigation
Follow Ups