This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Testing if an element has an attribute
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] Testing if an element has an attribute
- From: "Michael Kay" <mhkay at iclway dot co dot uk>
- Date: Mon, 8 Oct 2001 18:40:01 +0100
- Reply-To: xsl-list at lists dot mulberrytech dot com
> Does anyone know how to test if an element has an attribute?
In your case, simplest is <xsl:template match="person[@name]">
> I'm currently trying the following
>
> <xsl:template match="person">
> <xsl:if @name != "">
> // this
> line is causing the problem
It should be <xsl:if test="@name!=''">. Stylesheets must be well-formed XML.
Mike Kay
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list