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 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 |
Please rate the article: |
Hi all
Style sheet is so complicated.
Do you know any reverse engineering tool from SAP standard XSL file?
Well, the PI Sheet stylesheet is really not designed for being self explanatory. Normally customers should not need to change something here. Therefore there is no method provided by SAP to do some kind of reverse engineering. But if you do you’ll need to make changes I suggest to start with small things to gain some confidence. Make sure the people working on this are well experienced with web development and XML techniques.
Use my tip in an earlier post on an offline environment.
Remember that SAP does not offer any support for issues with custom stylesheets! Even if your problem is not related to your custom stylesheet you might need to prove this for any OSS messages.
So think twice before deciding to achieve a functionality by changing the stylesheet – if there is another option use that.