473,400 Members | 2,163 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,400 software developers and data experts.

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">Paul</person>
<person ... myattr="bbb">Peter</person>
<person ... myattr="ccc">Karl</person>
.....
<person ... myattr="ddd">Stan</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 18877


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">Paul</person> <person ...
myattr="bbb">Peter</person> <person ... myattr="ccc">Karl</person>
.... <person ... myattr="ddd">Stan</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>yesccc</xsl:text>
</xsl:choose>
<xsl:otherwise>
<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
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;...
134
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...
5
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. ...
1
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...
7
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...
3
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...
6
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...
1
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
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.