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 XML searching 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 "XML searching XSL" Watch "XML searching XSL" New topic

XML searching XSL

Balaji Loganathan
author and deputy

Joined: Jul 13, 2001
Posts: 3150

<xsl:when test="normalize-space(document('Data.xml.xml')/Data/Person/id)='12')">
<h2><xsl:value-of select="document('Data.xml.xml')/Data/Person/name"/> </h3>

I'm trying to search a xml document for id=12 and then display the corresponding name value.
This is not working for me.Please note that my xml file is very large,os it should terminate upon finding the data.
Please tell me how to do it.

Spritle Software Blogs
Mapraputa Is
Leverager of our synergies

Joined: Aug 26, 2000
Posts: 10065
<xsl:value-of select="document('bool12.xml')/Data/person/name[../id='12']"/>
will do it. But you should check how your XSLT processor implements document() function. Most XSLT processors are DOM-based, it may happen that your file will be read as a whole anyway, regardless of how you implement search. I read that Saxon works with SAX, maybe you will have to use it, if you do not already.
Balaji Loganathan
author and deputy

Joined: Jul 13, 2001
Posts: 3150
Yes Thanks again.Its worked.
It took app 10secs to pick a name for a specific code,i picked three names in random xml file sixe is 3.5MB.
Haven't tired Saxon.Will try soon.
Originally posted by Mapraputa Is:
<xsl:value-of select="document(
I agree. Here's the link:
subject: XML searching XSL
It's not a secret anymore!