Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to create an XSL FO From an XHTML File? How can I can convert XHTML to XSLFO?
    primarykey
    data
    text
    <p>I have an XHTML Template. I want to create an XSL FO from the XHTML Template. How can I can convert XHTML to XSLFO? I created XSL FO by using string replacement of XHTML File. Is it possible to create XSL FO for a template with out using string replacement? Below is my XHTML template.</p> <pre><code>&lt; div&gt; {:header:}{:date:} &lt; p&gt; {:mailingattn:} &lt; br /&gt; {:facilityname:} &lt; br /&gt; {:facilitystreet:} &lt; br /&gt; {:facilitystreet2:} &lt;br /&gt; {:facilitycity:}, {:facilitystate:} {:facilityzip:} &lt; br /&gt; {:facilitycountry:} &lt; /p&gt; &lt; br /&gt; &lt; p&gt;abcd,&lt;/p&gt; &lt; p&gt;The Department of abcd:&lt; /p&gt; &lt; p&gt;{:checkreturnreason:}&lt; /p&gt; &lt; p&gt;{:message:}&lt; /p&gt; &lt; pnext&gt;If you have any questions or need assistance, please feel free to abcd:&lt; /pnext&gt; &lt; pnext&gt;Sincerely, &lt;br /&gt; {:signature:} &lt; /pnext&gt; {:footer:} &lt; /div&gt; </code></pre> <p>The Predefined XSL FO Template</p> <pre><code>&lt; xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"&gt; &lt; xsl:output method="xml"/&gt; &lt; !-- expects a rootpath attribute in one of the tags. this should correspond to the physical path of the apps folder without the ending slash --&gt; &lt; xsl:variable name="rootpath" select="//@rootpath" /&gt; &lt; xsl:template match="/"&gt; &lt; xsl:apply-templates/&gt; &lt; /xsl:template&gt; &lt; xsl:template match="div"&gt; &lt; xsl:apply-templates/&gt; &lt; /xsl:template&gt; &lt; xsl:template match="img"&gt; &lt; fo:external-graphic height="auto" width="auto"&gt; &lt; xsl:attribute name="src"&gt; &lt; xsl:value-of select="concat($rootpath, substring-after(@src,'../..'))" /&gt; &lt; /xsl:attribute&gt; &lt; /fo:external-graphic&gt; &lt; /xsl:template&gt; &lt; xsl:template match="xsl:value-of"&gt; &lt; xsl:copy-of select="." /&gt; &lt; /xsl:template&gt; &lt; xsl:template match="br"&gt; &lt; fo:block&gt; &lt; /fo:block&gt; &lt; /xsl:template&gt; &lt; xsl:template match="p"&gt; &lt; fo:block space-before="8pt" space-after="4pt"&gt; &lt; xsl:apply-templates/&gt; &lt; /fo:block&gt; &lt; /xsl:template&gt; &lt; xsl:template match="pnext"&gt; &lt; fo:block keep-with-next="always" space-before="8pt" space-after="4pt"&gt; &lt; xsl:apply-templates/&gt; &lt; /fo:block&gt; &lt; /xsl:template&gt; &lt; xsl:template match="table"&gt; &lt; fo:table width="100%" font-family="Arial"&gt; &lt; fo:table-body&gt; &lt; xsl:for-each select="tr"&gt; &lt; fo:table-row&gt; &lt; xsl:for-each select="td"&gt; &lt; xsl:variable name="width"&gt; &lt; xsl:value-of select="@width"/&gt; &lt; /xsl:variable&gt; &lt; fo:table-cell padding-top='4pt' width="{$width}"&gt; &lt; xsl:for-each select="span"&gt; &lt; xsl:variable name="fsize"&gt; &lt; xsl:value-of select="@size"/&gt; &lt; /xsl:variable&gt; &lt; fo:block font-size="{$fsize}pt" text-align="right"&gt; &lt; xsl:apply-templates/&gt; &lt; /fo:block&gt; &lt; /xsl:for-each&gt; &lt; /fo:table-cell&gt; &lt; /xsl:for-each&gt; &lt; /fo:table-row&gt; &lt; /xsl:for-each&gt; &lt; fo:table-row&gt; &lt; fo:table-cell border=".2pt solid black"&gt; &lt; /fo:table-cell&gt; &lt; fo:table-cell border=".2pt solid black"&gt; &lt; /fo:table-cell&gt; &lt; /fo:table-row&gt; &lt; /fo:table-body&gt; &lt; /fo:table&gt; &lt; /xsl:template&gt; &lt; /xsl:stylesheet&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload