Microsoft KB Archive/278500

= How To Specify an XSL File to Transform the XML Stream from a Query with SQL Server 2000 =

Article ID: 278500

Article Last Modified on 7/13/2004

-

APPLIES TO


 * Microsoft SQL Server 2000 Standard Edition

-



This article was previously published under Q278500



SUMMARY
This article demonstrates how to specify an XSL file as a parameter on a post to a SQL Server 2000 virtual root.



MORE INFORMATION
This article is based on the assumption that the reader is familiar with the configuration for SQL Server 2000's virtual root and associated virtual names for templates and schema. The virtual root and virtual names are set up through the Configure SQL XML Support in IIS utility. For additional information, see SQL Server Books Online. The Help page for this utility is called &quot;Creating the nwind Virtual Directory.&quot;

This article assumes the following configuration:

When you are specifying an XSL file on a URL for a template query it may be somewhat confusing. For example, when a template file contains a reference to an XSL style sheet, the style sheet would be specified using &quot;sql:xsl=&quot; as shown in the following example: 

Additionally if the template file contains an XPath query, the template file would reference the associated mapping schema located within the schema directory &quot;C:\VirtualRoot\Schema&quot; by using &quot;mapping-schema=&quot; as shown in the follow snippet from a template file:  

There is an assumption many people make when they make the transition to specifying the XSL on the post for the template query. Many consider the Template directory analogous to a &quot;working directory&quot; especially when considering how the mapping schema is referenced for an XPath query example. However, when the XSL file is specified on the URL request to explicitly point to the XSL file shown below, the request must specify the path to the XSL file relative to the VirtualRoot, which is &quot;C:\VirtualRoot&quot;. Therefore, if the Template file is in the Template directory &quot;C:\VirtualRoot\Template&quot;, the XSL file would have to be specified as &quot;XSL=Template/SomeXslFile.xsl&quot; as shown in the following example: http://www.ServerName.com/VirtualRoot/Template/Template.XML?XSL=Template/SomeXslFile.xsl

This behavior is by design. For additional information, see SQL Server Books Online. The Help page titled &quot;Specifying an XSL Style Sheet in a Template&quot; covers this subject in more detail.

Additional query words: template query xsl sql url xml

Keywords: kbhowto KB278500

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.