My input looks as follow
<Report>
Report Title\.br\\.br\SECTION1\.br\\.br\****Plain Text*****\.br\\.br\SECTION2\.br\\.br\******Plain Text*****\.br\\.br\*****Plain Text*****
</Report>
I would like to add the below html tags using XSLT and have my output look as follow
<Report>
<html> <head> </head> <body> <p> <b><u>Report Title</u></b> </p> <p align="left"> </p> <p align="left"> <b>SECTION1</b> </p> <p align="left"> *****Plain Text***** </p> <p align="left"> </p> <p align="left"> <b>SECTION2</b> </p> <p align="left"> *****Plain Text***** </p> <p align="left"> </p> <p align="left"> *****Plain Text******<b> </b> </p> </body> </html>
</Report>
any thoughts on how to achieve this?
I started by creating the below variables to tokenize my report body
<xsl:variable name="ReportText" select="/Report" />
then I taught of breaking down the tags by opening and closing tags
Opening Report Tags: <html> <head> </head> <body>
Closing Report Tags: </body> </html>
Report Title Opening Tags: <p> <b><u>
Report Title Closing Tags: </u></b> </p> <p align="left> </p>
Section Opening Tags: <p align="left"> <b>
Section Closing Tags: </b> </p>
Text Opening Tags: <p align="left">
Text Closing Tags: </p> <p align="left">
created the below variables to reflect the break down
<xsl:variable name="OpeningReportTags" select="'<html> <head> </head> <body>'" />
<xsl:variable name="ClosingReportTags" select="'</body> </html>'" />
<xsl:variable name="OpeningTitleTags" select="'<p> <b><u>'" />
<xsl:variable name="ClosingTitleTags" select="'</u></b> </p> <p align="left"> </p>'" />
<xsl:variable name="OpeningSectionTags" select="'<p align="left"> <b>'" />
<xsl:variable name="ClosingSectionTags" select="'</b> </p>'" />
<xsl:variable name="OpeningTextTags" select="'<p align="left">'" />
<xsl:variable name="ClosingTextTags" select="'</p> <p align="left">'" />
In my example, I worked out that there are 11 tokens.
- I know my first token is always going to be the title
- Second token is always going to be a Section
- there can be 1 to n Sections
- There can be many lines of text between Sections where in this case the Token will be a null value
I am having trouble as the number of tokens is not static and will very much change based on the input report.
tokenize()function.