{"id":23179,"date":"2013-05-13T17:00:59","date_gmt":"2013-05-13T11:30:59","guid":{"rendered":"http:\/\/vskills.in\/certification\/tutorial\/?p=23179"},"modified":"2024-04-12T14:23:50","modified_gmt":"2024-04-12T08:53:50","slug":"xslt-style-sheet-and-root-template","status":"publish","type":"page","link":"https:\/\/www.vskills.in\/certification\/tutorial\/xslt-style-sheet-and-root-template\/","title":{"rendered":"XSLT Style Sheet and root template"},"content":{"rendered":"<h1>XSL Style Sheet<\/h1>\n<p>An Extensible Stylesheet Language (XSL) style sheet can be applied to the query results. When you execute a template using HTTP, you can specify an XSL file in these ways:<\/p>\n<ul>\n<li><span style=\"line-height: 1.714285714; font-size: 1rem;\">Use the <strong>sql:xsl<\/strong> attribute in the template.<\/span><\/li>\n<li><span style=\"line-height: 1.714285714; font-size: 1rem;\">Use the<strong> xsl<\/strong> keyword as part of the URL to specify the XSL file that will be used to process the resulting XML data.<\/span><\/li>\n<\/ul>\n<p><em id=\"__mceDel\">If the XSL file is specified both in the template using <strong>sql:xsl<\/strong> and in the URL using the keyword xsl, the XSL style sheet specified in the template is applied to the results first, and then the XSL file specified in the URL is applied.<br \/>\n<\/em><\/p>\n<p><strong><em id=\"__mceDel\">Examples:<\/em><\/strong><\/p>\n<p><em id=\"__mceDel\">In the following example, <strong>nwind<\/strong> is a virtual directory created using the IIS Virtual Directory Management for SQL Server utility, and <strong>template<\/strong> is the virtual name of <strong>template<\/strong> type defined when the virtual directory is created (any name can be given to a virtual name when it is created). For more information, see Using IIS Virtual Directory Management for SQL Server Utility.<br \/>\nA. Specify sql:xsl in a template to process the result<br \/>\nIn this example, a template includes a simple SELECT statement. The query result is processed according to the instructions in the XSL file specified using <strong>sql:xsl.<\/strong><br \/>\n&lt;?xml version =&#8217;1.0&#8242; encoding=&#8217;UTF-8&#8242;?&gt;<br \/>\n&lt;root xmlns:sql=&#8217;urn:schemas-microsoft-com:xml-sql&#8217;<br \/>\nsql:xsl=&#8217;MyXSL.xsl&#8217;&gt;<br \/>\n&lt;sql:query&gt;<br \/>\nSELECT FirstName, LastName FROM Employees FOR XML AUTO<br \/>\n&lt;\/sql:query&gt;<br \/>\n&lt;\/root&gt;<br \/>\nFor illustration purposes, the <strong>template<\/strong> (<strong>Template<\/strong>WithXSL.xml) is stored in the directory associated with the virtual name<b>FirstName<\/b> (template), of template type. The XSL file (MyXSL.xsl) is also stored in the same directory.<br \/>\nThis is the XSL file:<br \/>\n&lt;?xml version=&#8217;1.0&#8242; encoding=&#8217;UTF-8&#8242;?&gt;<br \/>\n&lt;xsl:stylesheet xmlns:xsl=&#8221;http:\/\/www.w3.org\/1999\/XSL\/Transform&#8221; version=&#8221;1.0&#8243;&gt;<br \/>\n&lt;xsl:template match = &#8216;Employees&#8217;&gt;<br \/>\n&lt;TR&gt;<br \/>\n&lt;TD&gt;&lt;xsl:value-of select = &#8216;@FirstName&#8217; \/&gt;&lt;\/TD&gt;<br \/>\n&lt;TD&gt;&lt;B&gt;&lt;xsl:value-of select = &#8216;@LastName&#8217; \/&gt;&lt;\/B&gt;&lt;\/TD&gt;<br \/>\n&lt;\/TR&gt;<br \/>\n&lt;\/xsl:template&gt;<br \/>\n&lt;xsl:template match = &#8216;\/&#8217;&gt;<br \/>\n&lt;HTML&gt;<br \/>\n&lt;HEAD&gt;<br \/>\n&lt;STYLE&gt;th { background-color: #CCCCCC }&lt;\/STYLE&gt;<br \/>\n&lt;\/HEAD&gt;<br \/>\n&lt;BODY&gt;<br \/>\n&lt;TABLE border=&#8217;1&#8242; style=&#8217;width:300;&#8217;&gt;<br \/>\n&lt;TR&gt;&lt;TH colspan=&#8217;2&#8242;&gt;Employees&lt;\/TH&gt;&lt;\/TR&gt;<br \/>\n&lt;TR&gt;&lt;TH &gt;First name&lt;\/TH&gt;&lt;TH&gt;Last name&lt;\/TH&gt;&lt;\/TR&gt;<br \/>\n&lt;xsl:apply-templates select = &#8216;root&#8217; \/&gt;<br \/>\n&lt;\/TABLE&gt;<br \/>\n&lt;\/BODY&gt;<br \/>\n&lt;\/HTML&gt;<br \/>\n&lt;\/xsl:template&gt;<br \/>\n&lt;\/xsl:stylesheet&gt;<\/em><\/p>\n<div class=\"apply\">\n<h5>Go to- <a href=\"https:\/\/www.vskills.in\/certification\/tutorial\/xml-developer\/\" target=\"_blank\" rel=\"noopener noreferrer\"><strong>Certified XML Developer Tutorial<\/strong><\/a><\/h5>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>XSL Style Sheet An Extensible Stylesheet Language (XSL) style sheet can be applied to the query results. When you execute a template using HTTP, you can specify an XSL file in these ways: Use the sql:xsl attribute in the template. Use the xsl keyword as part of the URL to specify the XSL file that&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[3353],"tags":[3681],"class_list":["post-23179","page","type-page","status-publish","hentry","category-xml","tag-xslt-style-sheet-and-root-template"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>XSLT Style Sheet and root template - Tutorial<\/title>\n<meta name=\"description\" content=\"XSLT Style Sheet and root template\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.vskills.in\/certification\/tutorial\/xslt-style-sheet-and-root-template\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"XSLT Style Sheet and root template - Tutorial\" \/>\n<meta property=\"og:description\" content=\"XSLT Style Sheet and root template\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.vskills.in\/certification\/tutorial\/xslt-style-sheet-and-root-template\/\" \/>\n<meta property=\"og:site_name\" content=\"Tutorial\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/vskills.in\/\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-12T08:53:50+00:00\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/xslt-style-sheet-and-root-template\/\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/xslt-style-sheet-and-root-template\/\",\"name\":\"XSLT Style Sheet and root template - Tutorial\",\"isPartOf\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#website\"},\"datePublished\":\"2013-05-13T11:30:59+00:00\",\"dateModified\":\"2024-04-12T08:53:50+00:00\",\"description\":\"XSLT Style Sheet and root template\",\"breadcrumb\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/xslt-style-sheet-and-root-template\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.vskills.in\/certification\/tutorial\/xslt-style-sheet-and-root-template\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/xslt-style-sheet-and-root-template\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"XSLT Style Sheet and root template\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#website\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\",\"name\":\"Tutorial\",\"description\":\"Vskills - A initiative in elearning and certification\",\"publisher\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.vskills.in\/certification\/tutorial\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#organization\",\"name\":\"Vskills\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg\",\"contentUrl\":\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg\",\"width\":73,\"height\":55,\"caption\":\"Vskills\"},\"image\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/vskills.in\/\",\"https:\/\/x.com\/vskills_in\",\"https:\/\/www.linkedin.com\/company-beta\/1371554\/\",\"https:\/\/www.youtube.com\/channel\/UCMWnscxPwRF_PqXo9B7q_Tw\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"XSLT Style Sheet and root template - Tutorial","description":"XSLT Style Sheet and root template","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.vskills.in\/certification\/tutorial\/xslt-style-sheet-and-root-template\/","og_locale":"en_US","og_type":"article","og_title":"XSLT Style Sheet and root template - Tutorial","og_description":"XSLT Style Sheet and root template","og_url":"https:\/\/www.vskills.in\/certification\/tutorial\/xslt-style-sheet-and-root-template\/","og_site_name":"Tutorial","article_publisher":"https:\/\/www.facebook.com\/vskills.in\/","article_modified_time":"2024-04-12T08:53:50+00:00","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/xslt-style-sheet-and-root-template\/","url":"https:\/\/www.vskills.in\/certification\/tutorial\/xslt-style-sheet-and-root-template\/","name":"XSLT Style Sheet and root template - Tutorial","isPartOf":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#website"},"datePublished":"2013-05-13T11:30:59+00:00","dateModified":"2024-04-12T08:53:50+00:00","description":"XSLT Style Sheet and root template","breadcrumb":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/xslt-style-sheet-and-root-template\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.vskills.in\/certification\/tutorial\/xslt-style-sheet-and-root-template\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/xslt-style-sheet-and-root-template\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.vskills.in\/certification\/tutorial\/"},{"@type":"ListItem","position":2,"name":"XSLT Style Sheet and root template"}]},{"@type":"WebSite","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#website","url":"https:\/\/www.vskills.in\/certification\/tutorial\/","name":"Tutorial","description":"Vskills - A initiative in elearning and certification","publisher":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.vskills.in\/certification\/tutorial\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#organization","name":"Vskills","url":"https:\/\/www.vskills.in\/certification\/tutorial\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/","url":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg","contentUrl":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg","width":73,"height":55,"caption":"Vskills"},"image":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/vskills.in\/","https:\/\/x.com\/vskills_in","https:\/\/www.linkedin.com\/company-beta\/1371554\/","https:\/\/www.youtube.com\/channel\/UCMWnscxPwRF_PqXo9B7q_Tw"]}]}},"_links":{"self":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/23179","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/comments?post=23179"}],"version-history":[{"count":4,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/23179\/revisions"}],"predecessor-version":[{"id":134001,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/23179\/revisions\/134001"}],"wp:attachment":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/media?parent=23179"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/categories?post=23179"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/tags?post=23179"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}