File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes Dynamically querying XML using XSL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Dynamically querying XML using XSL" Watch "Dynamically querying XML using XSL" New topic

Dynamically querying XML using XSL

Sham Jowsaki
Ranch Hand

Joined: May 22, 2001
Posts: 146
Hi all,
My requirement is to dynamically send a query to XML file depends upon the user's selection and get the output.
we are giving the option of getting the uid from the user. Assume the user enters the uid 1 and it should give the output "Sham".
How to do this using XSL / JSP. Expecting your valuable reply in the near future.
Thanks in advance.

Mapraputa Is
Leverager of our synergies

Joined: Aug 26, 2000
Posts: 10065
You can pass uid as a parameter to your XSLT. How to do it depends on which XSLT processor you use, check documentation! Here is how you would do it with Xalan.
Then you have to declare this parameter in your XSLT:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="" version="1.0">
<xsl:param name="uid" select="'default value'"/>

And then you can use it like this (for example):
<xsl:template match = "result/row[./uid=$uid">

[This message has been edited by Mapraputa Is (edited July 31, 2001).]

Uncontrolled vocabularies
"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet
I agree. Here's the link:
subject: Dynamically querying XML using XSL
jQuery in Action, 3rd edition