Thursday, 30 April 2020

Workday XSL Coding Tips

XSL Coding Tips


Using Variables (Declaration) :


<xsl:variable name="NEWLINE" select="'&#xa;'"/>
<xsl:variable name="PIPE" select="'|'"/>   [Use the delimiter that you would like to see in the output. Examples: Comma(,), Tab (    ), Pipe(|), SemiColon(;) ]
               <xsl:variable name="Record1" select="'C'"/>
               <xsl:variable name="Record2" select="'S'"/>

Using your Variable: (for above)


              <xsl:value-of select="$NEWLINE"/> [This takes the cursor to next line]
              <xsl:value-of select="$PIPE"/>  [This prints | ]
      <xsl:value-of select="$Record1"/>     [This prints C]
      <xsl:value-of select="$Record2"/>     [This prints S]

Using Fillers (Declaration):

    <xsl:variable name="Filler_Blank" select="'                                                                                                                            '"/>
            <xsl:variable name="Filler_Zeros" select="'0000000000000000000000'"/>

Using your Fillers and Substring Function: (for above)

             <xsl:value-of select="substring($Filler,1,10)"/>           [This prints 10 spaces, if you say 15 then it will print 15 spaces ]
             <xsl:value-of select="substring($Filler_Zeros,1,4)"/>  [This prints 0000 as you said 4]

Using Plain Text:


<xsl:value-of select="'TEST'"/>

Using Comment:


<!--  Your Comment Here  -->  

Using Choose:


    <xsl:choose>
<xsl:when test=" wd:Gender = 'Male' ">
   <xsl:value-of select="'M'"/>
        </xsl:when>
<xsl:when test=" wd:Gender = 'Female' ">
   <xsl:value-of select="'F'"/>
        </xsl:when>
        <xsl:otherwise>
                  <xsl:value-of select="'U'"/>
        </xsl:otherwise>
    </xsl:choose>

Using For:


<xsl:for-each select="wd:Report_Data/wd:Report_Entry">

          <Your Lines of code here>

        </xsl:for-each>

Using Templates:


    <xsl:template match="/">
        <xsl:call-template name="HeaderRecord"/>
        <xsl:call-template name="DetailRecords"/>
        <xsl:call-template name="TrailerRecord"/>
    </xsl:template>


    <xsl:template name="HeaderRecord">

          <Your Lines of code here>

    </xsl:template>



    <xsl:template name="DetailRecords">

          <Your Lines of code here>
    </xsl:template>


    <xsl:template name="TrailerRecord">

          <Your Lines of code here>
    </xsl:template>

Workday Custom Reports

Custom Reports Apart from  Workday - Standard Reports , Workday allows you to create Custom Reports. There are variety of reports that ...