473,569 Members | 2,782 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 14221


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
2469
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...
6
29929
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....
1
1675
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...
15
5632
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...
7
21602
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...
3
2737
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...
0
3308
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...
0
1461
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...
17
5665
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...
0
7693
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...
0
7917
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
8118
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
7962
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
5501
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
3651
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
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2105
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
1207
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.