[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Constraint Searching in XML via XSLT

Subject: Constraint Searching in XML via XSLT
From: Joel Beach <j.beach@xxxxxxxxxxx>
Date: Thu, 19 Jul 2001 10:27:07 +1000
joel beach
Hi everyone...

I am using XML as a kind of client-side database for the project I'm currently doing. I have an SQL database on the server side which generates XML data files, and also XML an XML index file. The XML index file contains an ID for each data file (in this case a Trial), and a whole lot of attributes. I want to transform into an HTML Search Result. I want to do this by setting top-level parameters in the XSLT stylesheet (these parameters are to be the values for the constraints).

My XML Index File looks something like this....

<?xml version="1.0"?>
<!DOCTYPE IndexFile SYSTEM "vfdindex.dtd">

<vfdindex:IndexFile
   xmlns:vfdindex='http://www.cs.mu.oz.au/SE-projects/s340gt/vfdindex/'>

    <vfdindex:TrialID value="1">
        <vfdindex:TrialName>Lentil Trial</vfdindex:Rainfall>
	   <vfdindex:Rainfall>700</vfdindex:Rainfall>
	   <vfdindex:SoilType>Some soil</vfdindex:SoilType>
	   <vfdindex:CropType>Lentils</vfdindex:CropType>
        <vfdindex:RegionName>Birchip</vfdindex:RegionName>
    </vfdindex:TrialID>
    <vfdindex:TrialID value="2">
        <vfdindex:TrialName>Wheat Trial</vfdindex:Rainfall>
	   <vfdindex:Rainfall>1400</vfdindex:Rainfall>
	   <vfdindex:SoilType>Some soil</vfdindex:SoilType>
	   <vfdindex:CropType>Wheat</vfdindex:CropType>
        <vfdindex:RegionName>Melbourne</vfdindex:RegionName>
    </vfdindex:TrialID>

</vfdindex:IndexFile>

Basically, I want to input one or more values for TrialName, Rainfall, SoilType, CropType, RegionName and so on. I can implement it fine for one constraint, where I have one top-level parameter for the value I want to search for. The constraint to be searched for was fixed.

However, the way I did it before was like this:

* Make a template which matches only on a TrialID whose constraint is equal to the value specified in the top-level parameter. (Just using <xsl:template> with the match attribute)

I don't think this will work for a more complex case.

So, my questions are these.

1. If a constraint is not specified, how do I get the XSLT stylesheet to match all elements?

2. In the case of rainfall, I want to allow users to specify a rainfall *range*. Is it possible to do this in XSLT? I had a look and there seem to be < and > operators.

3. Should I be using <xsl:choose> and <xsl:if> instead of <xsl:template> for this sort of stuff?

Thanks everyone!!!

Joel


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.