Use XML template

zhaozj2021-02-16  137

Using the XML template is the general form of template, showing how to specify SQL queries and XPath queries:

.. .. ... N SQL Statement (s) XPath Query

Any elements in the template are optional. Elements

, , , and feature mapping schema are defined in SQL namespace. Therefore, XMLns: SQL = "URN: SCHEMAS-Microsoft-COM: XML-SQL" must be declared in the namespace. You can name any of the namespace; SQL is just an alias.

Specify this tag to provide a single top element (also known as root mark) for the resulting XML document. The tag can be any name.

This tag is used to save all titles values. In the current implementation, you can only specify elements in this mark. is used as a tag that enables you to define multiple parameters. All parameter definitions are in a location, which makes the processing parameter definition more efficient.

This element is used to define parameters that are passed to the query within the template. Each element defines a parameter. Multiple elements can be defined in the tag.

This element is used to specify SQL queries. Multiple elements can be specified in the template.

This element is used to specify the XPath query. Because the XPath query is executed on the XML data simplification (XDR) schema with annotation, the architecture file name must be specified using the mapping-schema feature.

SQL: XSL

This feature is used to specify the extensible style sheet language (XSL) style sheet that will be applied to the resulting XML document. When specifying a map architecture file, you can specify a relative or absolute path. The specified relative path is a directory associated with a virtual name with the template type. For example, if the directory associated with the Template type virtual name is C: / Template, the relative path XYZ / MyxSl.xml specified for SQL: XSL will be mapped to C: /Template/xyz/myxsl.xml.

Mapping-schema

This feature is used to identify the XDR architecture with annotation. This feature is only specified when the XPath query is executed in the template. XPath Query is executed on the XDR architecture with annotation. When specifying a map architecture file, you can specify a relative or absolute path. The specified relative path is a directory associated with a virtual name with the template type. For example, if the directory associated with the Template type virtual name is C: / Template, the relative path (schema / mschema.xml specified for mapping-schema) is mapped to C: /Template/schema/mschema.xml. Note Each or represents a separate transaction. Therefore, if there are multiple or tags in the template, other tags will continue when a tag fails.

If contentType is set, Sqlisapi.dll returns the title information to the browser. If CONTENTTYPE is not set, URLMON determines the content type using the first character in the template file. If the first character in the template is the

You must use the IIS Virtual Directory Administrative Utility for SQL Server to create a virtual name for the IIS virtual directory management utility for SQL Server before specifying a template. For more information, see Using the IIS Virtual Directory Administration utility used for SQL Server.

The storage template template is stored in a directory associated with the Template type of virtual name or one of its subdirectories:

If the template is stored in a directory associated with the Template type, the URL query is as follows: http://iisserver/nwind/templatevirtualname/templatefile.xml

If the template is stored in a subdirectory associated with the virtual name (XYZ) virtual name, the URL query is as follows: http://iisserver/nwind/templatevirtualname/xyz/templatefile.xml Specifies the XSL style table in the template Query results apply Scalable Style Sheet Language (XSL) style sheet. When using the HTTP to perform the template, you can specify the XSL file with the following method: Use SQL: XSL feature in the template. Use the XSL keyword as part of the URL to specify the XSL file that will be used to process the resulting XML data. If you use SQL: XSL to specify the XSL file in the template and use the keyword XSL to specify the XSL file in the URL, first apply the result to the XSL style sheet specified in the template and then applied to the XSL file specified in the URL. Example In the following example, NWind is a virtual directory created using the IIS Virtual Directory Management utility for SQL Server. Template is a virtual name for the template type defined when creating a virtual directory (you can specify any virtual name for it when you create a virtual directory. ). For more information, see Using the IIS Virtual Directory Administration utility used for SQL Server. A. Specify SQL: XSL in the template to handle the results in the following example, the template contains a simple SELECT statement. Follow the instructions in the XSL file specified by SQL: XSL to process query results. SELECT FirstName, LastName from Employees for XML Auto To illustrate, TemplateWithxSl.xml is stored in a directory associated with the Template type virtual name (Template). The XSL file (myxsl.xsl) is also stored in the same directory.

Here is the XSL file: