This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Conditional text using attributes
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] Conditional text using attributes
- From: "Chris Bayes" <Chris at Bayes dot co dot uk>
- Date: Thu, 28 Dec 2000 17:26:04 -0000
- Reply-To: xsl-list at lists dot mulberrytech dot com
Beth,
Have you tried
<xsl:template match="*|@*|comment()|text()">
<xsl:if test="not(@os='Mac')">
<xsl:copy-of select="." />
</xsl:if>
</xsl:template>
Ciao Chris
XML/XSL Portal
http://www.bayes.co.uk/xml
>-----Original Message-----
>From: owner-xsl-list@lists.mulberrytech.com
>[mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of Beth Fischi
>Sent: 28 December 2000 16:42
>To: XSL-List@lists.mulberrytech.com
>Subject: [xsl] Conditional text using attributes
>
>
>I'm trying to figure out how to exclude text and graphics from an output
>file (HTML or FO, for example) by testing for attributes in my XSL
>stylesheet. For instance, I have an XML file with instructions
>appropriate for both Macintosh users and Windows users. In one output
>file, I want to exclude the instructions for Mac users, and in another,
>I want to exclude the instructions for Windows users so I end up with a
>set appropriate to each type of user.
>
>I'm using the DocBook DTD and Norm Walsh's DocBook XSL stylesheets
>(http://nwalsh.com/docbook/xsl/index.html). I've created an XSL file
>called "bj.xsl" that extends his HTML XSL stylesheet. In it, I have a
>test case that (hopefully?) excludes all elements, attributes, comments
>and text with the attribute "Mac":
>
>*****************************************
><?xml version='1.0'?>
><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version='1.0'
> xmlns="http://www.w3.org/TR/xhtml1/transitional"
> exclude-result-prefixes="#default">
>
><xsl:include href="docbook.xsl"/>
>
><xsl:template match="*|@*|comment()|text()">
> <xsl:if test="not(@os='Mac')">
> <xsl:copy>
> <xsl:apply-templates select="*|@*|comment()|text()" />
> </xsl:copy>
> </xsl:if>
></xsl:template>
>
></xsl:stylesheet>
>*****************************************
>This doesn't work, but I'm not sure what I'm doing wrong. Any
>suggestions would be greatly appreciated.
>
>--Beth Fischi
>
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list