RE: [xsl] How to produce X when an attribute of an element does not exist orequals Y?

Subject: RE: [xsl] How to produce X when an attribute of an element does not exist orequals Y?
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 9 Jul 2008 08:22:05 +0100
> Hi, I'm new to the listserv and to XSL. Using the XML below 
> and XSLT 1.0, I would like content to appear both when an 
> attribute of an element does not exist and when it equals X. 
> Specifically, I would like the contents of data-field tag 555 
> to appear if this data-field does not have any "ind1" 
> attribute, or if its ind1 equals 8.

Use the predicate [not(@ind1) or @ind1=8].

Or if you want to be clever about it, you can write [not(@ind1!=8)]

Michael Kay
http://www.saxonica.com/

Current Thread