[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Testing if an element has an attribute
an XSL stylesheet has to be XML <xsl:if @name != ""> isn't XML: you can only have attribute/value pairs inside the element start tag. You could change it to <xsl:if test="@name != ''"> and then it would be legal. However it doesn't do what the subject line suggests, it tests whether the attribute is non empty. In particular <person name=""/> has a name attribute but the above test would be true. If you want to test if person has an attribute just do <xsl:if test="@person"> however since you use the person attribute as an element name, I suspect that your first test is better. Also of course you have these lines in the wrong order </xsl:if> </xsl:element> you need to close the xsl:element inside the xsl:if since you started it inside th exsl:if. David _____________________________________________________________________ This message has been checked for all known viruses by Star Internet delivered through the MessageLabs Virus Scanning Service. For further information visit http://www.star.net.uk/stats.asp or alternatively call Star Internet for details on the Virus Scanning Service. 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
|