I'm trying to transform the following XML:
<
xml version="1.0" encoding="utf-8" ><
works> <work> <index>1</index> <title>Coeur d'Alene at Cataldo</title> <description></description> <size></size> <price>$990</price> </work></
works>Using the following XSLT:
<
xml version="1.0" encoding="UTF-8" ><
stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:param name="index">1</xsl:param> <xsl:template match="/"> <xsl:for-each select="work/index[index = $index]"> <div><xsl:value-of select="title" /></div> </xsl:for-each> </xsl:template></
stylesheet>The problem is that I keep receiving the following error:
The wrong namespace was used for XSL. Use 'http://www.w3.org/1999/XSL/Transform'.
Does anyone have any idea why this is happening and/or how to remedy this situation

The wrong name space was used for XSL headaches...
jbatty
Jim,
You are missing <xsl:stylesheet ... at your stylesheet. (the xsl: prefix)
Thanks,
Sinan
Ryan_H
Thanks for the help. When it comes to XML and XSLT I am a newbie. Isn't it obvious
Basically, what I'm trying to do is, use the XML server control to display information in a XML document. The only record in the document that I want is retrieved via a query string value. Below is my server side code:
//set server control properties
xmlDescription.DocumentSource= "../bin/works.xml";
xmlDescription.TransformSource= "../bin/works.xslt";
//create argument list and transformXsltArgumentList list =
new XsltArgumentList();list.AddParam("index", "",Request.QueryString["works"].ToString ());
xmlDescription.TransformArgumentList= list;
xmlDescription.Visible=
true;My revised xsl code is as follows:
<
xml version="1.0" encoding="UTF-8" ><
xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:param name="index"></xsl:param> <xsl:template match="works"> <xsl:for-each select="work/index[index == $index]"> <table cellspacing="0" cellpadding="2" width="100%"> <tr> <th>Title</th> </tr> <tr> <td> <value-of select="description" /> </td> </tr> <tr> <td> <value-of select="size" /> </td> </tr> <tr> <td> <b>Price: </b> <value-of select="price" /> </td> </tr> </table> </xsl:for-each> </xsl:template></
xsl:stylesheet>The new error message that I am receiving is:
The expression passed to this method should result in a NodeSet.
Any ideas. I'm still using the same XML file for my data.
Michael Lutz
There are multiple problems with the logic in your XSL, but you can figure that out eventually once you get past the first hurdle of a proper xsl document. Here is the correct document that should fix the majority of your troubles. You did not use the xsl namespace in the stylesheet tag which seems to be causing your problem.
< xml version="1.0" encoding="utf-8" >
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="index">1</xsl:param>
<xsl:template match="/">
<xsl:for-each select="works/work/index[. = $index]">
<div><xsl:value-of select="title" /></div>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>