473,385 Members | 1,890 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,385 software developers and data experts.

test to find value

I have an xml structure like:

<data>
<struct>1,8,7,30</struct>
</data>

and I need to develop a test that finds this node in each of these
cases, something like:

should find because 1 is in the node
<xsl:if test="struct='1'">

should find because 1 and 8 is in the node
<xsl:if test="struct='1,8'">

should find because 1 and 8 and 7 is in the node
<xsl:if test="struct='1,8,7'">

should find because 1 and 8 and 7 and 30 is in the node
<xsl:if test="struct='1,8,7,30'">

any help is appreciated.

Mike

Jul 20 '05 #1
3 1327

<xsl:variable name="x" select="concat(,normalize-space(struct),',')"/>

<xsl:if test="contains($x,',1,') and contains($x,',8,')">
contains 1 and 8
....
Jul 20 '05 #2


mike wrote:
I have an xml structure like:

<data>
<struct>1,8,7,30</struct>
</data>

and I need to develop a test that finds this node in each of these
cases, something like:

should find because 1 is in the node
<xsl:if test="struct='1'">

should find because 1 and 8 is in the node
<xsl:if test="struct='1,8'">

should find because 1 and 8 and 7 is in the node
<xsl:if test="struct='1,8,7'">

should find because 1 and 8 and 7 and 30 is in the node
<xsl:if test="struct='1,8,7,30'">


In XSLT there is
<xsl:choose>
<xsl:when test="struct = '1'">
...
</xsl:when>
<xsl:when test="struct = '1,8'">

</xsl:when>
</xsl:choose>
perhaps you are looking for that?
Or you can write an XPath expression with the boolean or
<xsl:if test="struct = '1' or struct = '1,8'">

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #3

I wrote

<xsl:variable name="x" select="concat(,normalize-space(struct),',')"/>

I meant

<xsl:variable name="x" select="concat(',',normalize-space(struct),',')"/>
Jul 20 '05 #4

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

Similar topics

0
by: Randell D. | last post by:
Folks, Ever since reading an interesting article in Linux Format on PHP whereby suggested code writing was made that could enhance performance on a server, I've started testing various bits of...
9
by: lawrence | last post by:
Someone on www.php.net suggested using a seems_utf8() method to test text for UTF-8 character encoding but didn't specify how to write such a method. Can anyone suggest a test that might work?...
6
by: Steve Jorgensen | last post by:
I'm posting this message for 2 reasons. First, I'm still pretty new and shakey to the whole Acceptance Testing thing, and I'm hoping for some feedback on whether I'm on the right track. Second,...
5
by: Jan Roland Eriksson | last post by:
Some more fine tuning and inclusion of last suggested text from regulars has been done to this test post #4 of the mFAQ. As usual, rip it up anywhere you feel that it's appropriate to do so. ...
15
by: lawrence | last post by:
Is this the correct way to test for a method before I use it? createRange() is, I believe, an IE only method. function wrapSelectionInTag(selection, tag) { if (document.selection.createRange)...
11
by: sara | last post by:
I am trying my first functions in my code. I have a set of queries that runs to create temp tables with the right data for some reports. They can run for a long time, so I want the user to know...
176
by: nw | last post by:
Hi, I previously asked for suggestions on teaching testing in C++. Based on some of the replies I received I decided that best way to proceed would be to teach the students how they might write...
2
by: emily224 | last post by:
Hello, I have been trying to understand this source code, which I retreived from my online course test. I would like to know how to find the answer for the question on the test. Im sure the answer...
4
by: emily224 | last post by:
Hello, I have been trying to understand this source code, which I retreived from my online course test. I would like to know how to find the answer for the question on the test. Im sure the answer...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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...

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.