Subject: RE: Test an attribut in all document
From: Ben Robb <Ben@xxxxxxxxxx>
Date: Thu, 12 Aug 1999 17:17:44 +0100
|
Use the <xsl:if> syntax in your templates
<xsl:if test="@ignore[.='false']">
display the contents
</xsl:if>
or if you are really worried about only hiding the "true" ones:
<xsl:choose>
<xsl:when test="@ignore[.='true']">
do nothing
</xsl:when>
<xsl:otherwise>
display the contents
</xsl:otherwise>
</xsl:choose>
Rgs,
Ben Robb
cScape
-----Original Message-----
From: Stephane St-Denis [mailto:Stephane.St-Denis@xxxxxx]
Sent: Thursday, August 12, 1999 4:38 PM
To: xsl-list@xxxxxxxxxxxxxxxx
Subject: Test an attribut in all document
Hi everybody !
I would like to ignore section with attribut Ignore="True".
XML Document
------------
<presentation ignore="false">
<title>Presentation</title>
<longname ignore="true"><content>DONT DISPLAY 1</content></longname>
<presentation>
<longname ignore="false"><content>DISPLAY 1</content></longname>
<presentation>
<longname ignore="true"><content>DONT DISPLAY 2</content></longname>
</presentation>
</presentation>
</presentation>
XSL StyleSheet
--------------
<xsl:template match="presentation/longname">
display longname with bold
</xsl:template>
<xsl:template match="presentation/presentation/longname">
display longname with italic
</xsl:template>
<xsl:template match="presentation/presentation/presentation/longname">
display longname with underline
</xsl:template>
I don't want to put a test of the attribute in all my template (example
"presentation/presentation/presentation/longname[@ignore='false']").
Is there a statement making it possible to not display the sections with
attribut "ignore=true"
anywhere in the XML document.
I try this statement :
<xsl:template match="*[@ignore='true']">
</xsl:template>
but is good only for the first level.
Thanks !!!
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|