I'm using SQL Server 2000 and an xml-template's XPath expression is created by the parameters sent from an HTML-form. How do I solve it if some fields in the form aren’t filled? I don’t want those to be a part of the XPath. It doesn’t work for example if the field Name is an empty string. Then the created XPath looks like ...[@Name=””], which results in no hits. But I want that to result in all hits. I want no comparisons with Name if I don't specify any Name in the HTML-form.

I would be able to solve this if I could write if-statements in the xml template. Can I? I also have tried to use xsl, but I haven’t succeeded to apply the style sheet on the xml template before the search in the database is done. Any hint is appreciated. /Tomas