Mailinglist Archive: opensuse-doc (7 mails)

< Previous Next >
Re: [opensuse-doc] XSLT question - how to hide some items?
  • From: Thomas Schraitle <thomas.schraitle@xxxxxxx>
  • Date: Tue, 9 Dec 2008 08:20:17 +0100
  • Message-id: <200812090820.18192.thomas.schraitle@xxxxxxx>
Hi,

On Monday 08 December 2008, Christian Boltz wrote:
[...]

# zypper --version
zypper 0.11.10

That's an outdated zypper version ;-) - openSUSE 11.1 has zypper
1.0.2.

I thought so. :)


I'll attach zypper output from 11.1 (and the updated XSLT file) in
case you want to test it.

Looks good. No complains so far. ;-)


[...]
If you really need this functionality, use
the document element from the EXSLT initiative, see [1].

The only functionality I need is "parse the XML and output
text/plain". I don't really care how or why it works as long as it
works ;-)

Well, you need it when you want to have more than one output files.


[...]
I found a working solution:

<!-- messages, unless type="info" -->
<xsl:template match="message">
<xsl:if test="@type != 'info'">
<xsl:text>&#10;ERROR: </xsl:text>
<xsl:apply-templates />
<xsl:text>&#10;</xsl:text>
</xsl:if>
</xsl:template>

You can omit the xsl:if clause with a predicate in "match" to make it
a bit more compact:

<xsl:template match="message[@type='info']">
<xsl:text>&#10;ERROR: </xsl:text>
<xsl:apply-templates />
<xsl:text>&#10;</xsl:text>
</xsl:template>

Maybe you need a another template to deal with general message
elements or with other message elements that contains other values in
your @type attributes. I haven't tested it. With your given XML file
both templates work.

Well, it's a matter of style not of functionality. :)


Tom

--
Thomas Schraitle

----------------------------------------------------------------------
SUSE LINUX GmbH >o) Documentation Specialist
Maxfeldstrasse 5 /\\
90409 Nuernberg _\_v http://en.opensuse.org/Documentation_Team
http://developer.novell.com/wiki/index.php/Lessons_for_Lizards
http://lizards.opensuse.org/author/thomas-schraitle/
---------------------------------------------------------------------
--
To unsubscribe, e-mail: opensuse-doc+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-doc+help@xxxxxxxxxxxx

< Previous Next >
List Navigation
Follow Ups
References