Creating PDF from Variables

166 views
Skip to first unread message

sagar....@flowian.com

unread,
Oct 27, 2014, 5:20:17 AM10/27/14
to suppor...@runmyprocess.com
Hi Team,

I am trying to create a PDF file from variables in the process as per given in the User guide.

But got error " Could not compile stylesheet".

Following is the XSL script
--------------------------------------------------

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="my_var_main ">
<html>
<body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th style="text-align:left">Title</th>
<th style="text-align:left">Artist</th>
</tr>
<tr>
<td><xsl:value-of select="Name"/></td>
<td><xsl:value-of select="Branch"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
--------------------------------------------------------------

and my variable is like
--------------------------------------------------------------
{"my_var_main":{"Name":"Sagar","Branch":"Arts","Mail_id":"sa...@gmail.com"}}

--------------------------------------------------------------

Could anyone help me to solve the problem?

Regards,
Sagar

Jeremy Le Pré

unread,
Oct 27, 2014, 6:15:05 AM10/27/14
to suppor...@runmyprocess.com
Hello Sagar,

While reading your code, I've seen 2 potential sources of error:

- 1st point:
   In the tutorial dedicated to PDF generation at :
   http://docs.runmyprocess.com/Developer_Guide/Process/Design/PDF
   You're given an example explaining that you have to use :

   <xsl:stylesheet ...
       <xsl:output...
       <xsl:template...

   ==> Don't forget the output line.
   ex:  <xsl:output method="xml" version="1.0" omit-xml-declaration="no" indent="yes"/>


- 2nd point :
   I saw you've used a loop in your xsl:

       ...
      </tr>
      <xsl:for-each "+your condition..."

      <tr>
      <td><xsl:value-of select="Name"/></td>
      <td><xsl:value-of select="Branch"/></td>
      </tr>
      </xsl:for-each>

   You can either begin and finish this loop or suppress the loop ending, if you have a simple table.

Regards,
The support team

sagar....@flowian.com

unread,
Oct 27, 2014, 7:09:12 AM10/27/14
to suppor...@runmyprocess.com
Hi jlepre,

Thanks for your reply,

I have removed errors mentioned by you but still the error is "Could not compile stylesheet".

Now the XLS code is as ------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" exclude-result-prefixes="fo">
<xsl:output method="xml" version="1.0" omit-xml-declaration="no" indent="yes"/>
<xsl:template match="my_var_main ">
<fo:html>
<fo:body>
<fo:table>
<fo:tr>
<fo:td> <xsl:value-of select="Name"/></fo:td>
<fo:td> <xsl:value-of select="Branch"/> </fo:td>
</fo:tr>
</fo:table>
</fo:body>
</fo:html>
</xsl:template>
</xsl:stylesheet>
--------------------------------------

Regards,
Sagar

Jeremy Le Pré

unread,
Oct 27, 2014, 9:19:36 AM10/27/14
to suppor...@runmyprocess.com
Ok,


I reviewed our conversation and it seems that you missed the first step of the PDF generation guide:
Configuration of the MS Word template


This step is supposed to help you generate the template (xsl) of your future PDF, based on a Word sheet. So you have to create a doc or docx file with looks alike the form you would to see in the end. You have an example at the end of the page.
Base on this example all you have to do, is to change the variables' name to match yours.

If needed, you can use the section below:
Don't forget to generate your template first. Without it, your XSL file will be partial and not compliant for compilation.
______________________________________
Jérémy LE PRÉ

PreSales Engineer at RunMyProcess

WebsiteFujitsu RunMyProcess

sagar....@flowian.com

unread,
Oct 28, 2014, 1:15:46 AM10/28/14
to suppor...@runmyprocess.com
Hi Jérémy,

Thank you for very much for your support.

I am confused between word document and the template. But now it is resolved and I am able to create PDF file.

Thanks once again.

Regards,
Sagar
Reply all
Reply to author
Forward
0 new messages