FAQ Database Discussion Community


Inserting a cover page into XSL:FO template

xml,xsl-fo,apache-fop
I have worked with these documents where I need to edit the existing code in order to map fields from a database. The XSL document already has the template and regions in place. My goal is to add a cover page before any of the margins of the template occur....

Indent children nodes in XSL-FO

xml,xslt,xsd,xsl-fo
I have XML structure like this <TestLog> <TestLogItem id="0" pid="-1"> <Message>some message</Message> </TestLogItem> <TestLogItem id="1" pid="0"> <Message>some message</Message> </TestLogItem> <TestLogItem id="2" pid="0"> <Message>some message</Message> </TestLogItem> <TestLogItem id="3" pid="2"> <Message>some message</Message> </TestLogItem> </TestLog> Every TestLogItem node has "id" and "pid(parentId)". I am showing the messages...

XSL-FO: How to set dynamic table width?

xsl-fo,fop,apache-fop
I have this problem: I need a FO-table, which is just as wide as the width of the content (cells). But when I add a table in my FO-markup, it is always acting like a Block-Level-Element and using the width of the wohle row. Confusing for me: If I wrap...

How best to re-use XSLT code when different groups of documents have different optional tag attributes for the same tags?

xslt,xslt-1.0,xsl-fo
Here is the scenario. I have XML documents with tags that look like this: <para a="A" b="B" c="C"> appearing in different classes of XML documents. The a and b attributes are completely generic and are handled exactly the same way in all documents. The optional c attribute is document class...

Dynamically change page header in XSLT

xml,xslt,xsl-fo
Dynamic change of page header in XSLT I want same Image to be in Header however the content over image should change dynamically according to value in XML node <fo:flow flow-name="header"> <fo:table> <fo:table-body> <fo:table-cell border="0pt"> <fo:block> <fo:external-graphic ID="headerlogo" src="url('imgae_url')" content-width="50%" content-height="50%"> <fo:table-cell border="0pt"> <fo:block margin-top="1.5cm" margin-right="1.2cm" text-align="left" > <fo:inline font-size="30pt"...

HashMap iteration in XSLT 2.0

java,xml,xslt,xslt-2.0,xsl-fo
I have an HashMap object as part of my java model and when I convert it into XML, this is the result... <transaction> <claims> <remarksMap> <entry> <string>XX</string> <string>Description 1</string> </entry> <entry> <string>YYY</string> <string>Description 2</string> </entry> <entry> <string>ZZZZ</string> <string>Description 3</string> </entry> </remarksMap> </claims> </transaction> I would like to...

Unanticipated behavior

xml,xslt,xslt-1.0,xsl-fo
I've been trying to figure out how to best modularize my XSLT stylesheets to facilitate re-use. I hit upon the idea of using <xsl:apply-imports/> as a way of introducing document-specific attributes to standard tag transformations. This is not working the way I expected it would, and I can't even begin...

XSL-FO Different header/footer depending on page-position

xslt,xsl-fo,fop
This might be a quite common problem with XSL-FO: I try to build a billing which has clear specifications: "Main Header": on every page (Text, Logo and Barcode) "Sub Header": (Customer Data) -> On the first page this block should be about 10% of the pages height -> On all...

How can I include images inside a text or paragraph

html,pdf,xsl-fo
Not sure about the right terminology as I'm rather new to xsl:fo. I'm creating some stylesheets to convert html pages to pdf, and all works pretty ok with exception to 'in paragraph' images. I'm having a few paragraphs including icons and I like to convert these to xsl:fo. The html...

How to split table after certain number of columns

xslt-1.0,xsl-fo
I have a little issue that I've been struggling with for a couple of days now. Here is input xml: <Facture> <Mensualite> <Lines> <Line> <NumeroMensualite>1</NumeroMensualite> <AnneeEcheance>2015</AnneeEcheance> <DateEcheance>20150618</DateEcheance> <Montant>163.14</Montant> </Line> <Line> <NumeroMensualite>2</NumeroMensualite> <AnneeEcheance>2015</AnneeEcheance> <DateEcheance>20150718</DateEcheance>...

Apache FOP: Print contents of list from XML in PDF without knowing list size?

java,xslt,xsl-fo,apache-fop
I have an XML that is being converted to PDF via Apache FOP, embedded in a Java program, and XSLT. This XML contains several lists of items; these lists are in the XML in a format like this: <NameOfList> <Listitem> <ListItemAttributeOne/> <ListItemAttributeTwo/> </ListItem> <ListItem> <ListItemAttributeOne/> <ListItemAttributeTwo/> </ListItem> <...more ListItems> </NameOfList>...

Python doesn't recognize environment variable

python,environment-variables,xsl-fo
I am trying do convert XSL-FO to PDF following this tutorial, but to do that I need to run a command that uses an environment variable called FOP_CMD: doc = Document(tfactory('/home/username/Downloads/file.fo')) doc.generate(params, oformat='pdf') I saved the environment variable in the file ~/etc/environment and if I run echo $FOP_CMD in the...

Formatting table columns to ignore duplicates XSLT-1.0

xslt,xslt-1.0,xsl-fo
I was hoping that someone could point me in the correct direction with a concept in XSLT 1.0. I am generating a PDF so the code is a bit long and I thought it would be more appropriate to include only the relevant bits. I have XML similar to the...

Apache FOP - XSL FO - count Intentionally left blank pages

xsl-fo,fop,apache-fop
My XSL: <fo:layout-master-set> <fo:simple-page-master master-name="normal" page-height="210mm" page-width="148mm"> <fo:region-body region-name="xsl-region-body" margin="28mm 2mm 10mm 8mm" /> <fo:region-before region-name="xsl-region-before"/> <fo:region-after region-name="xsl-region-after" extent="12mm"/> </fo:simple-page-master> <fo:simple-page-master master-name="blank" page-height="210mm" page-width="148mm"> <fo:region-body/> <fo:region-before...

Retrieve markers on different pages (first, last, and intermediate)

xsl-fo,fop,apache-fop
My XSL code: <fo:layout-master-set> <fo:simple-page-master master-name="page-even" page-height="210mm" page-width="148mm"> <fo:region-body region-name="xsl-region-body" margin="28mm 8mm 10mm 2mm" /> <fo:region-before region-name="xsl-region-before-even"/> <fo:region-after region-name="xsl-region-after-even" extent="12mm"/> </fo:simple-page-master> <fo:simple-page-master master-name="page-odd" page-height="210mm" page-width="148mm"> <fo:region-body region-name="xsl-region-body"...

Background-image not dispalys in xsl fo with Relative Path URL

image,pdf,xslt,relative-path,xsl-fo
I am trying to create a pdf using xsl-fo where the background image is being used. I have set up the relative path as follows:- background-image = "url('../themes/images/logo.gif')" When I give absolute path like background-image="C://Images/logo.gif", it worked. but when I use url to take it relatively in the server, it...

XSL-FO table-cell with superscript and vertical alignment

html,xml,xslt,xsl-fo
This is the situation: I am converting html to xsl-fo to pdf. I am displaying a heading text like "4.4.1. [Header Text]" by use of a table, because it might happen that the [Header Text] is quite long and in that case shall wrap onto the next line like so:...

How to get rid of the '\n' character while reading string from xsl?

java,xslt,xslt-1.0,xsl-fo
I'm reading xsl file using XSLReader class, and one of the columns contains strings but sometimes this string have enter in the (\n), so when I read this and print it I'm printing the string with the \n: those are two addresses, the first one have enter in the xsl...

Modern document templating and rendering

xsl-fo,fop,ecrion
I am looking to understand modern ways of document templating and batch rendering/generation to formats like PDF and Word. Are there alternative to XSL-FO based products e.g. CSS based products? Is there a better/emerging standard than XSL-FO? I have a few solution in mind that utilise the XSL-FO standard for...

Is there a way to count tags on a physical (PDF) page using XSL-FO?

xslt,xsl-fo
Here is the scenario. I have an XML document which contains tags. I want to create a transform that does this <tag>content A</tag> 1. content A <tag>content B</tag> ----> 2. content B <tag>content C</tag> 3. content C but only if the tag contents appear on the same physical page. The...

Summing based on matching values XSLT-1.0

xslt,xslt-1.0,xsl-fo
I'm currently trying to work with grouping in XSLT 1.0. I have XML similar to this: <table> <row> <PRODUCER type="VARCHAR" value="PRODUCER 1"/> <PUBLICATION_CODE_-_NAME type="VARCHAR" value="PUBLICATION A"/> <DOMESTIC type="DECIMAL" value="20"/> <FOREIGN type="DECIMAL" value="4"/> </row> <row> <PRODUCER type="VARCHAR" value="PRODUCER 1"/> <PUBLICATION_CODE_-_NAME type="VARCHAR" value="PUBLICATION B"/> <DOMESTIC type="DECIMAL" value="57"/> <FOREIGN type="DECIMAL"...

FOP, xsl-fo: disable line break

pdf-generation,line-breaks,xsl-fo,fop,apache-fop
With xsl-fo, I want to generate a pdf-file. The text for the pdf-file is a simple ongoing plain-text without any line-breaks in it. When I generate the pdf, there are line-breaks in the pdf, so after copying the text into Notepad, there are those line breaks, too. What I want...

Conditional page - breaking in fo:table

xsl-fo,page-break
I try to insert a conditional page break in my fo:table - without success ! This is a part of my XSL:FO template : <xsl:template match="Lignes"> <fo:block-container width="100%" top="11cm" position="absolute"> <fo:block color="black" font-family="Tahoma" font-size="12px" font-weight="normal"> my title </fo:block> <fo:block white-space-collapse="false" white-space-treatment="preserve" font-size="0pt" line-height="10px">. </fo:block> <fo:block color="black" font-family="Tahoma" font-size="10px"...