473,545 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XSLT: How to write "Yes" if element/attribute exist or "no" if not?

The solutions for the following problems seems to be simple but I did not found a (convenient) solution:
Assume we have a number of elements of the same type under a common parent e.g.
<person ... myattr="aaa">Pa ul</person>
<person ... myattr="bbb">Pe ter</person>
<person ... myattr="ccc">Ka rl</person>
.....
<person ... myattr="ddd">St an</person>
Now I want to write a text from inside an XSLT script with the following conditions:

1.) Write "yesccc" (e.g. into file) if an element <person> with an attribute value myattr="ccc" exist
otherwise write "noccc"

2.) Write "yesMick" (e.g. into file) if an element <person> with a value <person ...>Mick</person> exist
otherwise write "noMick"

2.) Write "yesAttrib" (e.g. into file) if an element <person> have an attrib myattrib="..... " defined
(value unimportant) otherwise write "noAttrib"

Thank you for your help

Mark

Jul 20 '05 #1
1 18890


Mark Richards wrote:
The solutions for the following problems seems to be simple but I did
not found a (convenient) solution: Assume we have a number of
elements of the same type under a common parent e.g.
<person ... myattr="aaa">Pa ul</person> <person ...
myattr="bbb">Pe ter</person> <person ... myattr="ccc">Ka rl</person>
.... <person ... myattr="ddd">St an</person>
Now I want to write a text from inside an XSLT script with the
following conditions:

1.) Write "yesccc" (e.g. into file) if an element <person> with an
attribute value myattr="ccc" exist otherwise write "noccc"


<xsl:choose>
<xsl:when test="//person[@myattr = 'ccc']">
<xsl:text>yescc c</xsl:text>
</xsl:choose>
<xsl:otherwis e>
<xsl:text>noccc </xsl:text>
</xsl:otherwise>
</xsl:choose>

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
11139
by: aagee | last post by:
Hi all Can someone clue me in on this? I just noticed that following doesn't work as it used to: window.open(... "fullscreen=yes" ...) Used to get a window that occupied the whole screen; now I get the title bar and status bar too. Any ideas?
134
7781
by: James A. Donald | last post by:
I am contemplating getting into Python, which is used by engineers I admire - google and Bram Cohen, but was horrified to read "no variable or argument declarations are necessary." Surely that means that if I misspell a variable name, my program will mysteriously fail to work with no error message. If you don't declare variables, you...
5
16430
by: Clint Stowers | last post by:
Access 2k Exporting a Query to as an excel file. No problem. However, I keep getting the warning that the file already exists, Overwrite Yes/No. Yes, I want to overwrite the file. SetWarnings On/Off has no affect. Any suggestions appreciated.
1
1901
by: D.M. | last post by:
Hi, One of the people here at work has designed a database that students will be using to enter data. She has Yes/No selection buttons, which start out grayed out with no value. If a student selects the Yes or No in error, is there any simple way to allow for the boxes to be unchecked again to "no selection"? Any help will be appreciated....
7
11648
by: tah | last post by:
Hey, Can someone please clarify, confirm, or set me straight on my understanding of a standalone="yes" attribute in the xml version element? I assume it means that the xml document containing it is standalone, and does not refer to any external document to define types. In other words, it doesn't use an external dtd to validate any types -...
3
5010
by: blakerrr | last post by:
Hello everyone, I am new with access and I am trying to insert my first hyperlink into my form. Here is the situation: I have a checkbox on the form. When it is clicked, a have a messagebox appear that asks (Do you want to launch website www.blahblahblah.com? Yes/No). I've gotten this far, I just don't know the VBA syntax to launch the...
6
6508
by: RSbroman | last post by:
I have created an append query that I would like to run when the DB is opened. However I do not want the end user to receive the "yes" "no" confirmation box when the query is being run. Can anyone help me remove this confirmation box?
1
3743
by: =?Utf-8?B?U3RldmUgQmVobWFu?= | last post by:
I am using Visual C++ 8.0 Express Edition. On certain events I would like to pop up the standard "Yes/No" dialog -- is this possible and, if so, how is this done?
4
9514
by: senthilkumarb | last post by:
Hi every body, i need a snippet in JavaScript to perform close window(browser) when we close window it should give alert with "YES" & "NO" button if yes the window should stay still otherwise window should close
0
7415
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7675
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7928
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7775
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5344
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3470
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3451
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1902
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1030
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.