Thanks for your reply. I forgot to say I am actually using xsl to display the xml. I have the xml and xsl working together fine but i wasn't sure how to manipulate the xsl and xml together to filter the products that I wanted.
But, I have gone down an alternative path, so thanks anyway.
: A you haven't specified exactly the way you want your data displayed, I assume you haven't tried XSL (Extensible Stylesheet Language) yet. XSL lets you transform the data structure in xml to a new one without changing the xml itself. In other terms, it means, you can sort or filter data in it.
: XSL is itself an xml file in as it must be well formed. It must contain well-formed HTML (xhtml) too. Just a portion of how your conditional formattong would look like.
: You must refer to this stylesheet in the XML file just after the first line (xml declaration)
: <?xml-stylesheet type="text/xsl" href="cd.xsl"?>
: <title>Title 1</title>
: <artist>Artist 1</artist>
: <title>Title 2</title>
: <artist>Artist 2</artist>
: <title>Title 3</title>
: <artist>Artist 3</artist>
: cd.xsl might look like this.
: <?xml version="1.0"?>
: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
: <xsl:template match="/">
: <head><title>Sample XSL Stylesheet</title></head>
: <xsl:for-each select="catalog/cd">
: <xsl:if test="price > 10">
: <td><xsl:value-of select="title"/></td>
: <td><xsl:value-of select="artist"/></td>
: It's just an example, you have to tailor it to your needs. You can find great tutorials on the net, eg. http://www.w3schools.com
on XML and XSL.
: : Hi
: : I have a problem with filtering my xml file.
: : I have created an xml data file containing information about products for a music store (eg. cd's). The xml works fine and is displaying fine. I'm a little confused as to how to filter the xml so that only the CD's that I want displayed are displayed. Does anybody know how to do this?
: : Please help!!
: : Thanks
To err is human, but to really foul things up requires a computer. (Farmers Almanac)