473,614 Members | 2,101 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Pass Query String Value to XSL for filtering

All,

I am relatively new to XML and I have what may sound like a dumb
question. I want to pass a query string variable to my xml document
and filter the output based on that variable. For example, if I type
in www.mysite.com?geid=0000123468 I want to display only
AccessReview/Report where GEID='000012346 8'. I appreciate any help you
can provide.

Corey

Here is the code for my request.

---------------------------------------------------
XML file
---------------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="AccessRev iew.xsl"?>
<Records>
<AccessReview >
<Report>Corey 's Report</Report>
<GEID>000362019 5</GEID>
</AccessReview>
<AccessReview >
<Report>Kim's Report #1</Report>
<GEID>000012346 8</GEID>
</AccessReview>
<AccessReview >
<Report>Kim's Report #2</Report>
<GEID>000012346 8</GEID>
</AccessReview>
<AccessReview >
<Report>Kim's Report #3</Report>
<GEID>000012346 8</GEID>
</AccessReview>
<AccessReview >
<Report>Ron's Report #1</Report>
<GEID>000020413 8</GEID>
</AccessReview>
<AccessReview >
<Report>Ron's Report #2</Report>
<GEID>000020413 8</GEID>
</AccessReview>
<AccessReview >
<Report>Ron's Report #3</Report>
<GEID>000020413 8</GEID>
</AccessReview>
<AccessReview >
<Report>Ron's Report #4</Report>
<GEID>000020413 8</GEID>
</AccessReview>
</Records>

---------------------------------------------------
XSL file
---------------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
<html>
<head><title>Ac cess Review</title>
</head>

<body>
<pre>
<xsl:for-each select="Records/AccessReview[GEID=variableNa me]">
<xsl:value-of select="Report"/>
</xsl:for-each>
</pre>
</body>
</html>

</xsl:template>
</xsl:stylesheet>

Jul 20 '05 #1
4 14229


Corey wrote:

I am relatively new to XML and I have what may sound like a dumb
question. I want to pass a query string variable to my xml document
and filter the output based on that variable. For example, if I type
in www.mysite.com?geid=0000123468 I want to display only
AccessReview/Report where GEID='000012346 8'.
Write a server-side script in the language of your choice (or the one
your server supports) to read out the query string first, then create an
XSLT processor, pass in the query string value as a parameter to the
stylesheet, run the transformation and send the result back to the browser.

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
A global stylesheet parameter is defined as
<xsl:param name="GEID" />
and then used as
<xsl:for-each select="Records/AccessReview[GEID=variableNa me]">


<xsl:for-each select="Records/AccessReview[GEID=$GEID]">

How you pass parameters to a stylesheet depends on the processor used,
usually there is an API alike
processor.setPa ram(name, value)
respectively
processor.setPa ram(name, namespace, value)
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #2
Thanks Martin. Is there any way to do it without using a server side
script? I'm a .NET guy but this project requires the use of a Unix
server which I know nothing about, including PHP and perl. Is there
any other way to do this? I appreciate your help.

Corey

Jul 20 '05 #3


Corey wrote:
Is there any way to do it without using a server side
script? I'm a .NET guy but this project requires the use of a Unix
server which I know nothing about, including PHP and perl. Is there
any other way to do this?


If you want to ensure visitors see the result of the XSLT transformation
then you have to do the transformation on the server, whether you want
to read the query string or not, browser support for XSLT
transformations is certainly not something to rely on on the web in general.
If you are sure you have only IE 6/Win clients (or IE 5/5.5 Win clients
with an updated version of MSXML 3 installed) or Mozilla 1.2 and later
clients with scripting enabled then of course you could start with an
HTML page with Javascript reading the query string and then doing the
transformation client-side triggered by script.
Sarissa is a library which can help with that:
<http://sarissa.sourcef orge.net/doc/>
But as said, on the web in general relying on client-side XSLT is not a
solution, you need to provide alternatives then anyway.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #4
I completely agree with your thoughts. This is just a band-aid
approach until an enterprise application can be built. Thanks for your
help.

Corey

Jul 20 '05 #5

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

Similar topics

1
2474
by: Alex Satrapa | last post by:
I have a table from which I'm trying to extract certain information. For historical reasons, we archive every action on a particular thing ('thing' is identified, funnily enough, by 'id'). So the only way to find out the current state of a particular combination of attributes is to "select distinct on (id, ...) ... order by date desc". In the examples below, I've taken real output from psql and done a global search/replace on various...
6
29931
by: Martin Lacoste | last post by:
Ok, before I headbutt the computer... don't know why when I add criteria in a query, I get an 'invalid procedure call'. I also don't know why after searching the help in access, the various access newsgroups, the access support centre, I can seem to find no similar situation. I am not using any references, or VBA at all in the first place. I am trying to set up a simple (or so I thought) query to work with the text of two tables. ...
1
1676
by: Eskil | last post by:
Hi I have a form that supplies my query with information on two different variables. The form uses a lookup to display a list of 5 different customer types and 5 different types of meetings/activities in two different combo boxes. Now, the values of form variables go into a query upon which a report is generated. By using those two variables my form can produce 25 different reports. But the report turns out empty on any combination...
15
5639
by: Rolan | last post by:
There must be a way to enhance the performance of a query, or find a plausible workaround, but I seem to be hitting a wall. I have tried a few tweaks, however, there has been no improvement. Simply, I'm including one calcualtion from a separate table/query. It sums the total units sold to date by ProductID number and is used in other select queries to perform various calculations. Perhaps there is an advantage in working with a maximum...
7
21612
by: Zlatko Matić | last post by:
Let's assume that we have a database on some SQL server (let it be MS SQL Server) and that we want to execute some parameterized query as a pass.through query. How can we pass parameters to the server ? Is it possible to use parameters in pass-through queries ? An additional question: Is it possible to connect to a database on MySQL or PostgreSQL using ADO ? Is it possible to execute pass-through queries with parameters, using ADO...
3
2739
by: Zlatko Matić | last post by:
Hello. I'm wondernig what is happennig whith saved pass-through queries nested in regular JET query if regular JET query just filtrates result by start/end date...Does pass-through query first returns all rows from server and then JET filtrates result by start/end date, or JET first communicates with server so that server returns only those rows that JET query would return after filtering by start/end date criteria ? For example, let's...
0
3315
by: Zlatko Matić | last post by:
Hi everybody! Recently I was struggling with client/server issues in MS Access/PostgreSQL combination. Although Access is intuitive and easy to use desktop database solution, many problems appear when someone is trying to use it as front-end for real server database systems such as PostgreSQL or MySQL. One of these problems is regarding pass-through queries and parameters. I wanted to have all the code on client, while executing it on...
0
1463
by: cephal0n | last post by:
Hi All! I have two table tblHome1, contains all the unique PinNo and tblHome2 contains a duplicated PinNo and description. I put an automatic numbering (ProdID) and set it as my index. What I want to do is make an automatic filtering and labeling method for my table. The reason for this is because I m handling more than 500 records and labeling them would take me forever, so I started with what I can understand, which is seeking 5 records...
17
5680
by: sharsy | last post by:
Hello guys, I would like some help in generating query criteria that will identify credit cards that have expired on an access database. The specific Field is formatted with a Data Type of 'Text' and has an input mask of '00/00', so all expiry dates are set out for example as 10/13 (which represents October 2013). I have hada brief go at trying to work it out, but I was unable to
0
8176
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8120
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8620
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8265
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7047
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6085
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5537
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2560
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
1705
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.