Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 20th, 2007, 01:30 PM
Authorized User
 
Join Date: Mar 2007
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default Testing for an attribute existence?

Dear Folks -

What would be the expression of testing for an attribute existence?

For example I'd like to test if the "link" is present in the "Entry" node:

<Entry link="test.htm">Test</Entry>

Thanks,
Gabster

 
Old November 23rd, 2007, 01:31 PM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

You can simply use @link in a boolean context e.g. assuming an Entry element is your context node then
  
Code:
<xsl:if test="@link">

checks whether it has link attribute or
  
Code:
<xsl:apply-templates select="Entry[@link]"/>

processes all Entry elements which have a link attribute.

 
Old November 26th, 2007, 11:37 AM
Authorized User
 
Join Date: Mar 2007
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Martin!!!

Thanks a lot!! That's it!!

Gabstero






Similar Threads
Thread Thread Starter Forum Replies Last Post
Check for existence of a cookie GLKGail Classic ASP Basics 0 June 10th, 2008 10:49 AM
How to check database existence? angelran Classic ASP Databases 0 October 30th, 2005 06:39 AM
Verifying Table Existence kpp01 Access 3 January 5th, 2005 07:23 AM
checking the existence of a file in a webdatabase TwoDee Excel VBA 0 January 14th, 2004 11:28 AM
Check for existence of a session variable apd8x ASP.NET 1.0 and 1.1 Basics 2 November 12th, 2003 11:09 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.