|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Conditional text using attributes
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@xxxxxxxxxxxxxxxxxxxxxx >[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Beth Fischi >Sent: 28 December 2000 16:42 >To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx >Subject: 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








