This blog has been discontinued (See latest posts)
Thursday, April 1, 2010 Stylesheet: XSL Basic Structure
VN:F [1.9.22_1171]
Rating: 5.0/5 (3 votes cast)

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 (<xsl:apply-templates …) and a brief description.

Note: This article is not completely finished, but I wanted to share it already with you 😉

Template Blocks
Template Block Description
<xsl:template match="/">
   ...
   <xsl:apply-templates select="./DOCUMENT"/>
   ...
   <xsl:apply-templates select="./DOCUMENT/HEADER"/>
   ...
   <xsl:apply-templates select="./DOCUMENT/CONTENT"/>
   ...
</xsl:template>
Basic HTML document structure
<xsl:template match="DOCUMENT">
   ...
</xsl:template>
PI Sheet Header
<xsl:template match="HEADER|CONTENT">
   ...
   <xsl:apply-templates select="PHASE"/>
   ...
</xsl:template>
Basic PI Sheet structure (around phase containers)
<xsl:template match="PHASE">
   ...
   <xsl:apply-templates select="./INSTRUCTION|INSTRUCTIONGROUP" mode="fill"/>
   ...
</xsl:template>
Phase container layout
<xsl:template match="INSTRUCTION[./@type='simple' and not(./@group) and ./@id]" mode="fill">
   ...
   <xsl:apply-templates select="./*[name()='TEXTOUTPUT' or name()='TEXTINPUT']" mode="simple"/>
   ...
   <xsl:apply-templates select= "./*[not(name()='MESSAGE' or name()='TEXTOUTPUT' or
   name()='TEXTINPUT') or EXECUTE[@visible='true' or @ondisplay='true']]" mode="simple" />
   ...
</xsl:template>
Simple instruction. This also includes the elements for drawing a box around instructions dividing any instructions that have a separate long text.

The last ‘apply templates’ tag catches all simple elements (e.g. output field, input field,…)

<xsl:template match="INSTRUCTION[@type='repeat' and ./LINE[1]/*[@id and position()=1]
and not(@group)]" mode="fill">
   <xsl:call-template name="builderrepeat"/>
</xsl:template>
<xsl:template name="builderrepeat">
   ...
   <xsl:apply-templates select="./LINE[1]/*[(not(name()='MESSAGE') and ./@id) or
   EXECUTE[@visible='true' or @ondisplay='true']]" mode="all"/>
   ...
   <xsl:apply-templates select="./LINE[1]/*[(./@id and not(name()='MESSAGE')) or
   EXECUTE[@visible='true' or @ondisplay='true']]" mode="repeat"/>
   ...
</xsl:template>
Repeated data request (table)

The first template called from here is handling the column (mode=”all”) titles and the second one calls the ones for the content (mode=”repeat”).

<xsl:template match="INSTRUCTIONGROUP" mode="fill">
   <xsl:call-template name="buildergroup"/>
</xsl:template>
<xsl:template name="buildergroup">
   ...
   <xsl:apply-templates select="../INSTRUCTION[@group=$instrgroupid][1]/*[
   (not(name()='MESSAGE') and ./@id) or EXECUTE[@visible='true' or @ondisplay='true']]"
   mode="all"/>
   ...
   <xsl:apply-templates select="./*[(not(name()='MESSAGE') and ./@id) or
   EXECUTE[@visible='true' or @ondisplay='true']]" mode="repeat"/>
   ...
</xsl:template>
Grouped simple instructions (table)

The first template called from here is handling the column (mode=”all”) titles and the second one calls the ones for the content (mode=”repeat”).

...
More to come
Stylesheet: XSL Basic Structure, 5.0 out of 5 based on 3 ratings
Please rate the article:
VN:F [1.9.22_1171]
Rating: 5.0/5 (3 votes cast)
2 Comments Create new comment
  1. 14.Jul.2011 at 06:06 | Permalink

    Hi all
    Style sheet is so complicated.
    Do you know any reverse engineering tool from SAP standard XSL file?

News

This blog has been discontinued!

Archives

Calendar

April 2010
M T W T F S S
 1234
567891011
12131415161718
19202122232425
2627282930