Note that there are some explanatory texts on larger screens.

plurals
  1. POGenerate a pdf to document a database in XSLT
    text
    copied!<p>I have a XML related to a database and have to generate a PDF to document the database. I am using FOP to convert XSLT to PDF.</p> <p>XML:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt; &lt;sql-catalog xmlns="http://www.abc.com"&gt; &lt;schemas&gt; &lt;schema name="abc&gt; &lt;tables&gt; &lt;table name="tab123" degree="1" type="TABLE" rows="144"&gt; &lt;columns&gt; &lt;column name="asd" nullable="true" order="1" sqlType="CHARACTER VARYING" sqlLength="255" fixedLength="2"/&gt; &lt;column name="pqr" nullable="true" order="2" sqlType="CHARACTER VARYING" sqlLength="255" fixedLength="2"/&gt; &lt;/columns&gt; &lt;constraints/&gt; &lt;datafiles&gt; &lt;datafile href="abc.txt" checksum="6ba3a161d5" size="12354" format="FIXED" valid="true" recordTerminator="&amp;#xD;&amp;#xA;" checksumtype="MD5" rows="905"/&gt; &lt;/datafiles&gt; &lt;/table&gt; &lt;/tables&gt; &lt;/schema&gt; &lt;/schemas&gt; &lt;/sql-catalog&gt; </code></pre> <p>I have to display the table name, number of columns and column name. I have written the following in XSLT.</p> <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt; &lt;xsl:stylesheet version="2.0" xmlns:ex="http://exslt.org/dates-and-times" extension-element-prefixes="ex" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:ora="http://www.oracle.com/XSL/Transform/java/" xmlns:xdofo="http://xmlns.oracle.com/oxp/fo/extensions" xmlns:xdoxslt="http://www.oracle.com/XSL/Transform/java/oracle.apps.xdo.template.rtf.XSLTFunctions" xmlns:xdoxliff="urn:oasis:names:tc:xliff:document:1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:cat="http://www.abc.com"&gt; &lt;xsl:output method="xml" encoding="ISO-8859-1"/&gt; &lt;xsl:template match="cat:sql-catalog"&gt; &lt;fo:root&gt; &lt;fo:layout-master-set&gt; &lt;fo:simple-page-master master-name="A4" page-height="297mm" page-width="210mm" margin-left="2cm" margin-right="2cm" margin-top="2.0cm" margin-bottom="1.0cm"&gt; &lt;fo:region-body/&gt; &lt;fo:region-after extent="1cm"/&gt; &lt;/fo:simple-page-master&gt; &lt;/fo:layout-master-set&gt; &lt;fo:page-sequence master-reference="A4"&gt; &lt;fo:static-content flow-name="xsl-region-after" font-size="8pt"&gt; &lt;fo:block text-align="right"&gt; &lt;fo:page-number/&gt; &lt;/fo:block&gt; &lt;/fo:static-content&gt; &lt;fo:flow flow-name="xsl-region-body"&gt; &lt;fo:block font-weight="bold" font-size="8pt" space-after="0.5cm"&gt; &lt;xsl:value-of select="cat:schemas/schema/tables/table/@name" /&gt; &lt;/fo:block&gt; &lt;/fo:flow&gt; &lt;/fo:page-sequence&gt; &lt;/fo:root&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p>In the code I have tried to display the name of the table which is in the attribute, but it doesn't seem to work. Can any one please tell me where am I going wrong here? And also how to count the number of columns in the table.</p>
 

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