[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Conditional text using attributes

Subject: Conditional text using attributes
From: Beth Fischi <bfischi@xxxxxxxxxxxxx>
Date: Thu, 28 Dec 2000 10:42:14 -0600
conditional text
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.