aspose file tools*
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
Author

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.
<result>
<row>
<uid>1</uid>
<name>sham</name>
</row>
<row>
<uid>2</uid>
<name>guru</name>
</row>
</result>
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.
Jowsaki

Mapraputa Is
Leverager of our synergies
Sheriff

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="http://www.w3.org/1999/XSL/Transform" 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: http://aspose.com/file-tools
 
subject: Dynamically querying XML using XSL
 
Similar Threads
reading the name of the attribute from xml file
Mulitple fo:page-sequence
PLEASE HELP ME!!Creating drop down list using XSL
XSL again!Please help me Creating HTML with INPUT HIDDEN TYPE
XSL-FO