473,406 Members | 2,816 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,406 software developers and data experts.

search an XML node for a string

Hello

I was wandering if anyone could help me with this problem, I have the
following xsl file which searches the <description> node of my xml file.
This node can contain text with more than one word and white space e.g.

<catalog>
<product>
<item>shoes</item>
<description>white trainers</description>
</product>
</catalog>

At the moment, if I enter "white trainers" or "white trainers leather" in
the textfield on my html file, the desired results are output by the xsl
file.

I was wandering what code I could use instead of or along with <xsl:if
test="contains($text1, description)"> so that if I entered the following
queries, the results would also be output by the xsl file:-

white
White
trainers
TRAINERS
white green trainers

and "trainer" if possible, but this query is not really as important as the
others.

<?xml version="1.0"?>

<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>

<xsl:param name="text1" />

<xsl:template match="/">

<html>

<head>
<link rel="stylesheet" type="text/css" href="/web/files/mystyle.css" />
<title>Results</title>
</head>

<body>

<table width="600" border="1" align="center" cellpadding="0" cellspacing="0"
bordercolor="#FFFFFF">

<col width="100%" />

<tr>

<th class="fill">Item</th>

</tr>

<xsl:for-each select="catalog/product">
<xsl:if test="contains($text1, description)">

<tr>

<td align="center"><xsl:apply-templates select="./item" /></td>

</tr>

</xsl:if>

</xsl:for-each>

</table>

<div align="center">
<a href="/web/index.html">Click here to return to search page</a>
</div>

</body>

</html>

</xsl:template>

</xsl:stylesheet>

I would be very greatful for any help on this.

Thanks
Thomas
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.721 / Virus Database: 477 - Release Date: 16/07/2004
Jul 20 '05 #1
0 1292

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

Similar topics

2
by: Paul Lee | last post by:
Hi all, I'm trying to use a Java written search code to traverse a DOM hierarchy. I'm mainy using code that I obtained from the Sun website. Basically, in main(), I have Element rootElement =...
4
by: Tarique Jawed | last post by:
Alright I needed some help regarding a removal of a binary search tree. Yes its for a class, and yes I have tried working on it on my own, so no patronizing please. I have most of the code working,...
19
by: RAJASEKHAR KONDABALA | last post by:
Hi, Does anybody know what the fastest way is to "search for a value in a singly-linked list from its tail" as oposed to its head? I am talking about a non-circular singly-linked list, i.e.,...
7
by: Bonj | last post by:
In making a ternary search tree to identify as fast as possible the type of word passed in to the algorithm, for instance sp_help -> 1 (procedures), select -> 2 (keywords), sysobjects -> 3 (system...
4
by: BenCoo | last post by:
Hello, In a Binary Search Tree I get the error : Object must be of type String if I run the form only with the "Dim bstLidnummer As New BinarySearchTree" it works fine. Thanks for any...
5
by: foolproofplan | last post by:
Hey everyone. I am running into a problem with unique ids that need to be compared in two xml files. The actual object name is represented with its unique id later in the xml file, so i need to do...
1
by: Lord Raiden | last post by:
Hello lads i have a problem about the Breadth First Search . I need to do an implementation of a checking algorith that check from a Game Graph that i have create if every non-object node appears...
2
by: Defected | last post by:
Hi, How i can implement a main function with this Binary Search Tree. thanks for help. is this code corrected ? #include<iostream>
2
by: Bart Kastermans | last post by:
Summary: can't verify big O claim, how to properly time this? On Jun 15, 2:34 pm, "Terry Reedy" <tjre...@udel.eduwrote: Thanks for the idea. I would expect the separation to lead to somewhat...
2
by: slizorn | last post by:
hi guys, i need to make a tree traversal algorithm that would help me search the tree.. creating a method to search a tree to find the position of node and to return its pointer value basically i...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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,...
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
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...
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,...

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.