{"id":802,"date":"2010-04-01T14:09:05","date_gmt":"2010-04-01T12:09:05","guid":{"rendered":"http:\/\/websha.de\/xstepcafe\/?p=802"},"modified":"2018-06-01T06:45:21","modified_gmt":"2018-06-01T04:45:21","slug":"stylesheet-xsl-basic-structure","status":"publish","type":"post","link":"https:\/\/websha.de\/xstepcafe\/2010\/04\/01\/stylesheet-xsl-basic-structure\/","title":{"rendered":"Stylesheet: XSL Basic Structure"},"content":{"rendered":"<p>To start with a custom stylesheet development the first step is to understand the basic structure of the standard XSL stylesheet which is used to define the conversion of the XML structure to the HTML-based PI Sheet you see in CO60. So here is a simplified structure overview which shows all major template blocks in the XSL stylesheet. I also added the calls inside of those templates that lead to other templates (&lt;xsl:apply-templates &#8230;) and a brief description.<!--more--><\/p>\n<p><strong>Note:<\/strong> This article is not completely finished, but I wanted to share it already with you \ud83d\ude09<\/p>\n<div style=\"text-align: center;\">\n<table cellspacing=\"0\" cellpadding=\"0\">\n<caption>Template Blocks<\/caption>\n<thead>\n<tr>\n<th>Template Block<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\n<pre>&lt;xsl:template match=\"\/\"&gt;\r\n   ...\r\n   &lt;xsl:apply-templates select=\".\/DOCUMENT\"\/&gt;\r\n   ...\r\n   &lt;xsl:apply-templates select=\".\/DOCUMENT\/HEADER\"\/&gt;\r\n   ...\r\n   &lt;xsl:apply-templates select=\".\/DOCUMENT\/CONTENT\"\/&gt;\r\n   ...\r\n&lt;\/xsl:template&gt;<\/pre>\n<\/td>\n<td>Basic HTML document structure<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>&lt;xsl:template match=\"DOCUMENT\"&gt;\r\n   ...\r\n&lt;\/xsl:template&gt;<\/pre>\n<\/td>\n<td>PI Sheet Header<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>&lt;xsl:template match=\"HEADER|CONTENT\"&gt;\r\n   ...\r\n   &lt;xsl:apply-templates select=\"PHASE\"\/&gt;\r\n   ...\r\n&lt;\/xsl:template&gt;<\/pre>\n<\/td>\n<td>Basic PI Sheet structure (around phase containers)<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>&lt;xsl:template match=\"PHASE\"&gt;\r\n   ...\r\n   &lt;xsl:apply-templates select=\".\/INSTRUCTION|INSTRUCTIONGROUP\" mode=\"fill\"\/&gt;\r\n   ...\r\n&lt;\/xsl:template&gt;<\/pre>\n<\/td>\n<td>Phase container layout<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>&lt;xsl:template match=\"INSTRUCTION[.\/@type='simple' and not(.\/@group) and .\/@id]\" mode=\"fill\"&gt;\r\n   ...\r\n   &lt;xsl:apply-templates select=\".\/*[name()='TEXTOUTPUT' or name()='TEXTINPUT']\" mode=\"simple\"\/&gt;\r\n   ...\r\n   &lt;xsl:apply-templates select= \".\/*[not(name()='MESSAGE' or name()='TEXTOUTPUT' or\r\n   name()='TEXTINPUT') or EXECUTE[@visible='true' or @ondisplay='true']]\" mode=\"simple\" \/&gt;\r\n   ...\r\n&lt;\/xsl:template&gt;<\/pre>\n<\/td>\n<td>Simple instruction. This also includes the elements for drawing a box around instructions dividing any instructions that have a separate long text.<\/p>\n<p>The last &#8216;apply templates&#8217; tag catches all simple elements (e.g. output field, input field,&#8230;)<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>&lt;xsl:template match=\"INSTRUCTION[@type='repeat' and .\/LINE[1]\/*[@id and position()=1]\r\nand not(@group)]\" mode=\"fill\"&gt;\r\n   &lt;xsl:call-template name=\"builderrepeat\"\/&gt;\r\n&lt;\/xsl:template&gt;\r\n&lt;xsl:template name=\"builderrepeat\"&gt;\r\n   ...\r\n   &lt;xsl:apply-templates select=\".\/LINE[1]\/*[(not(name()='MESSAGE') and .\/@id) or\r\n   EXECUTE[@visible='true' or @ondisplay='true']]\" mode=\"all\"\/&gt;\r\n   ...\r\n   &lt;xsl:apply-templates select=\".\/LINE[1]\/*[(.\/@id and not(name()='MESSAGE')) or\r\n   EXECUTE[@visible='true' or @ondisplay='true']]\" mode=\"repeat\"\/&gt;\r\n   ...\r\n&lt;\/xsl:template&gt;<\/pre>\n<\/td>\n<td>Repeated data request (table)<\/p>\n<p>The first template called from here is handling the column (mode=&#8221;all&#8221;) titles and the second one calls the ones for the content (mode=&#8221;repeat&#8221;).<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>&lt;xsl:template match=\"INSTRUCTIONGROUP\" mode=\"fill\"&gt;\r\n   &lt;xsl:call-template name=\"buildergroup\"\/&gt;\r\n&lt;\/xsl:template&gt;\r\n&lt;xsl:template name=\"buildergroup\"&gt;\r\n   ...\r\n   &lt;xsl:apply-templates select=\"..\/INSTRUCTION[@group=$instrgroupid][1]\/*[\r\n   (not(name()='MESSAGE') and .\/@id) or EXECUTE[@visible='true' or @ondisplay='true']]\"\r\n   mode=\"all\"\/&gt;\r\n   ...\r\n   &lt;xsl:apply-templates select=\".\/*[(not(name()='MESSAGE') and .\/@id) or\r\n   EXECUTE[@visible='true' or @ondisplay='true']]\" mode=\"repeat\"\/&gt;\r\n   ...\r\n&lt;\/xsl:template&gt;<\/pre>\n<\/td>\n<td>Grouped simple instructions (table)<\/p>\n<p>The first template called from here is handling the column (mode=&#8221;all&#8221;)  titles and the second one calls the ones for the content  (mode=&#8221;repeat&#8221;).<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>...<\/pre>\n<\/td>\n<td><span style=\"color: #ff0000;\">More to come<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>To start with a custom stylesheet development the first step is to understand the basic structure of the standard XSL stylesheet which is used to define the conversion of the XML structure to the HTML-based PI Sheet you see in CO60. So here is a simplified structure overview which shows all major template blocks in [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_links_to":"","_links_to_target":""},"categories":[52],"tags":[40,54],"_links":{"self":[{"href":"https:\/\/websha.de\/xstepcafe\/wp-json\/wp\/v2\/posts\/802"}],"collection":[{"href":"https:\/\/websha.de\/xstepcafe\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/websha.de\/xstepcafe\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/websha.de\/xstepcafe\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/websha.de\/xstepcafe\/wp-json\/wp\/v2\/comments?post=802"}],"version-history":[{"count":28,"href":"https:\/\/websha.de\/xstepcafe\/wp-json\/wp\/v2\/posts\/802\/revisions"}],"predecessor-version":[{"id":2164,"href":"https:\/\/websha.de\/xstepcafe\/wp-json\/wp\/v2\/posts\/802\/revisions\/2164"}],"wp:attachment":[{"href":"https:\/\/websha.de\/xstepcafe\/wp-json\/wp\/v2\/media?parent=802"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/websha.de\/xstepcafe\/wp-json\/wp\/v2\/categories?post=802"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/websha.de\/xstepcafe\/wp-json\/wp\/v2\/tags?post=802"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}