Tuesday 24 December 2013

Conditionally Highlighting a Row in XML buplisher


This example demonstrates how to set a background color on every other row. The template to create this effect is shown in the following figure:
Here we are using same RTF which we had used in IF-THEN-ELSE lesson which is shown below
Now we are going to set back ground color for one by one row.
For that we have to place one form filed which is shown below
Just give double click on field and provide proper default text and click on Add Help Text which is shown below
There we are going to write below code
<?if@row:position() mod 2=0?>
<xsl:attribute name="background-color" xdofo:ctx="incontext">lightgray</xsl:attribute>
<?end if?>
Which is shown below
Then click on ‘OK’
Now our RTF looks
Default Text Entry
Form Field Help Text
Description
format;
<?if@row:position() mod 2=0?>
<xsl:attribute name="background-color" xdofo:ctx="incontext">lightgray</xsl:attribute>
<?end if?>
For each alternate row, the background color attribute is set to gray for the row.

Now we have to publish the report

Click on Template Builder => Preview => HTML/PDF/Excel/RTF (any format).
We can get below output
From the above output we get background color on every other row

1 comment:

  1. u have copied this from some other site.. it's the same..

    ReplyDelete