• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Dynamically querying XML using XSL

 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

 
Leverager of our synergies
Posts: 10065
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).]
reply
    Bookmark Topic Watch Topic
  • New Topic