473,625 Members | 2,628 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XSL-FO?

Hello list,

I'm using XML + XSL + CSS to display my data to the web. I also want to
publish my pages in PDF format. To accomplish this I first must
transform my XML + XSL + CSS in XSL-FO. Is there a know technique to
transform my data to XSL-FO without loosing my markup. For example,
transformation my data to XHTML first and later from XHTML to XSL-FO?

Hope someone can help me on this one.

Thanks in advance,

David

Jul 20 '05 #1
4 2725
On Wed, 07 Jan 2004 16:35:05 +0100, David <dv@quicknet.nl > wrote:
Hello list,

I'm using XML + XSL + CSS to display my data to the web. I also want
to publish my pages in PDF format. To accomplish this I first must
transform my XML + XSL + CSS in XSL-FO. Is there a know technique to
transform my data to XSL-FO without loosing my markup. For example,
transformation my data to XHTML first and later from XHTML to XSL-FO?


You're probably better off drawing from the initial XML (which has all
the domain markup) for both the XHTML and XSL-FO. That is

XML -> XHTML
-> XSL-FO

will probably be better for you than

XML -> XHTML -> XSL-FO

XHTML and XSL-FO are both presentation models. They'll have elements
that are there in order to get things formatted the way you want. Even
if you add attributes that would allow you to reconstruct the original
structure, it'd be a lot of work (possibly very tricky work) to get it
right.

For instance, you might have an array of things (field descriptions for
a database table is one I run across often). It may may sense to
display this as a table, but then you might having something like

<table class='fielddef s'>
<tr>
<th>#</th>
<th>Field Name</th>
<th>Type</th>
<th>Size</th>
</tr>
<tr class='fielddef '>
<td>1</td>
<td>Item_ID</td>
<td>char</td>
<td>10</td>
</tr>
</table>

You could probably pull this back out if you had to. However, if you
had more complete documentation (description of constraints, behavior,
acceptable values, etc. for each table), with field summaries in a table
such as above and full descriptions below[1], you'll have to find a way
to join them up again... which results in juggling more information and
making your script more complex.

OTOH, if you have an XHTML transformation for 'dbtable' and 'dbfield' it
is fairly simple (even for the presentation described above), and the
XSL-FO transformation for the same is about as simple. Each is
insulated from the other, you can share common code between the two
scripts, and they stay relatively simple.

[1] useful, IMO -- most of the time people just need a reminder of
structure, so the table is very useful, but having full doco below
makes it better.

All IMO, of course. It depends a lot on the complexity of the data and
layout for presentation.
Keith
--
Keith Davies "Your ability to bang your head against
ke**********@kj davies.org reality in the hope that reality will
crack first is impressive, but futile"
-- Geoffrey Brent, rec.games.frp.d nd
Jul 20 '05 #2
Keith Davies wrote:
On Wed, 07 Jan 2004 16:35:05 +0100, David <dv@quicknet.nl > wrote:
Hello list,

I'm using XML + XSL + CSS to display my data to the web. I also want
to publish my pages in PDF format. To accomplish this I first must
transform my XML + XSL + CSS in XSL-FO. Is there a know technique to
transform my data to XSL-FO without loosing my markup. For example,
transformatio n my data to XHTML first and later from XHTML to XSL-FO?

You're probably better off drawing from the initial XML (which has all
the domain markup) for both the XHTML and XSL-FO. That is

XML -> XHTML
-> XSL-FO

will probably be better for you than

XML -> XHTML -> XSL-FO

XHTML and XSL-FO are both presentation models. They'll have elements
that are there in order to get things formatted the way you want. Even
if you add attributes that would allow you to reconstruct the original
structure, it'd be a lot of work (possibly very tricky work) to get it
right.

For instance, you might have an array of things (field descriptions for
a database table is one I run across often). It may may sense to
display this as a table, but then you might having something like

<table class='fielddef s'>
<tr>
<th>#</th>
<th>Field Name</th>
<th>Type</th>
<th>Size</th>
</tr>
<tr class='fielddef '>
<td>1</td>
<td>Item_ID</td>
<td>char</td>
<td>10</td>
</tr>
</table>

You could probably pull this back out if you had to. However, if you
had more complete documentation (description of constraints, behavior,
acceptable values, etc. for each table), with field summaries in a table
such as above and full descriptions below[1], you'll have to find a way
to join them up again... which results in juggling more information and
making your script more complex.

OTOH, if you have an XHTML transformation for 'dbtable' and 'dbfield' it
is fairly simple (even for the presentation described above), and the
XSL-FO transformation for the same is about as simple. Each is
insulated from the other, you can share common code between the two
scripts, and they stay relatively simple.

[1] useful, IMO -- most of the time people just need a reminder of
structure, so the table is very useful, but having full doco below
makes it better.

All IMO, of course. It depends a lot on the complexity of the data and
layout for presentation.
Keith


Thanks for the explanation!

If I get you right, it's better to do a direct XML to XSL-FO conversion
with XSLT? But I don't quite understand how i can transform my server
xhtml pages to PDF without loosing my markup/layout which I've created
with XSL and CSS. I'nt their some kind of program which will accept my
XML + XSL + CCS as input and render an XSL-FO file for me? I know some
programs that will do a XML + XSL to XSL-FO conversion. But then my CSS
is'nt read, which will create very ugly PDF documents.

Maybee I'm to lazy and should create a XSL file to convert my XML into a
well formatted XSL-FO file, but something is telling me such a
possibillity is out there... ;)

Thanks again,
David

Jul 20 '05 #3
On Thu, 08 Jan 2004 00:52:52 +0100, David Vaartjes
<dv******@NOSPA Mquicknet.nl> wrote:

If I get you right, it's better to do a direct XML to XSL-FO
conversion with XSLT? But I don't quite understand how i can transform
my server xhtml pages to PDF without loosing my markup/layout which
I've created with XSL and CSS. Isn't their some kind of program which
will accept my XML + XSL + CCS as input and render an XSL-FO file for
me? I know some programs that will do a XML + XSL to XSL-FO
conversion. But then my CSS is'nt read, which will create very ugly
PDF documents.
There may be, but I'm not familiar with it; it hasn't come up in my
processing because my HTML and PDF documents are structured differently
enough that I've always had two channels for processing.

If I recall your original question, you wanted to build PDF based on the
XHTML. In my experience, the formatting differences between web and
print media are usually great enough to warrant different formatting.

For instance, on screen your horizontal space is very limited -- there's
only so much information you can present on a screen. On a page,
though, you have much more space (you can fit more legible text across a
page than across a screen), and that changes certain formatting
decisions. Footnotes are a pain in the ass on a web site; on paper they
can be very effective. Floats[1] are meaningless on a web page, but
very useful on paper. Two-column display doesn't generally look good on
a web page but again can be very effective on paper.

I have built some very good-looking documents, both in HTML and PDF.
I've written a number of reference documents for work where my 'base'
XML is highly domain specific. I run it through a transformation that
generates DocBookXML (which takes me from 'domain specific' to 'document
specific', which then gets run through other transformations . The HTML
version can connect to CSS (getting pretty web pages), the PDF might be
generated through a transformation to XSL-FO (which, from what I can
see, has a superset of CSS capabilities) or through LaTeX, which has
very impressive formatting capabilities.

[1] remember high school textbooks, where there would be a reference to
a table, but that table didn't appear until the top of the next
page? The table 'floated' to the next good place to place it. I've
had web pages print very oddly because a table split unnecessarily
or -- almost *worse* -- didn't quite fit and the entire thing got
moved to the next page, leaving a huge white area on the page where
it 'started'.
Maybee I'm to lazy and should create a XSL file to convert my XML into
a well formatted XSL-FO file, but something is telling me such a
possibillity is out there... ;)


I'm sure it is. If nothing else, you can load the HTML pages into a
browser, print to PDF (or PostScript and convert using Distiller or
other tool). If you do that, though, you limit yourself to the
formatting of the web pages, unless you load enough content indicators
(class attributes, etc.) into the HTML. In this case you're trying to
extract domain-specific information from the HTML to reconstruct the
initial state... a challenging task, to be sure, and fragile -- changes
to the HTML formatting might break everything you've done to convert
from HTML to PDF.

In my experience, it's much easier to run both series of transformations
up to the presentational transformation, then split at that point. In
both cases you have the richest, most domain-specific information
available and insulate yourself from changes to presentation, in either
direction.
Keith
--
Keith Davies "Your ability to bang your head against
ke**********@kj davies.org reality in the hope that reality will
crack first is impressive, but futile"
-- Geoffrey Brent, rec.games.frp.d nd
Jul 20 '05 #4
In article <2c************ *************** @news.multikabe l.nl>,
David Vaartjes <dv******@NOSPA Mquicknet.nl> wrote:

% If I get you right, it's better to do a direct XML to XSL-FO conversion
% with XSLT? But I don't quite understand how i can transform my server
% xhtml pages to PDF without loosing my markup/layout which I've created
% with XSL and CSS.

You have to do the layout over with xsl:fo. This can give you greater
control over the layout than CSS alone, but it is not an automatic
process.

% I'nt their some kind of program which will accept my
% XML + XSL + CCS as input and render an XSL-FO file for me?

You could use a web browser to print to a PS file, then distill it.

% I know some
% programs that will do a XML + XSL to XSL-FO conversion. But then my CSS
% is'nt read, which will create very ugly PDF documents.

The PDF documents will likely be different from the HTML+CSS equivalent,
but it would be difficult to make them uglier than a typical browser.
--

Patrick TJ McPhee
East York Canada
pt**@interlog.c om
Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2296
by: Jean-Christophe Michel | last post by:
Hi, In a complex merging of two (non ordered) xml files i need to keep track of the elements of the second tree that were already merged with first tree, to copy only unused elements at the end. I tried two solutions: * first is to 'substract' the used element from existing tree
1
1891
by: Philip | last post by:
Hi, I am trying to output certain nodes inside another. I have an xml template with field definitions for a form, and this includes textfields, labels, checkboxes etc plus fieldssets. I defined them like this: >>>> XML SNIPPET >>>> <fields>
8
2355
by: Sebastian Kerekes | last post by:
Greetings, I'm developing an application that supports multiple languages. In my XSL I use variables to place the text where it belongs to. At the top of the document I include those variables - the included file depends on the language. Atm I'm editing those file manually. Luckily atm it's only two languages I have to work with, but even in this case I forget to add a variable that I added in the other file, forget to use entities .....
0
1633
by: Jimmy | last post by:
Hi, I have a (multi-tier) XML document and a XSL transform file (that is meant to transform the XML into a flat structure so I can insert the data into a database table). I have reached a problem node when doing a search for a match. The following works: <xsl:template match="PlanningPortalXML/pp:PlanningApplication/pa1:form">
1
2621
by: discomiller | last post by:
Mario Mueller: Hello *, radiobuttons belong to other radiobuttons by the "name="any_value"" attribut. Thats a fakt. I got the following XML: **************************************************************
11
1911
by: Rolf Barbakken | last post by:
I have an xml with records like this one: <a:response> <a:href>http://server/public/sol/comp/1049306.eml</a:href> <a:propstat> <a:status>HTTP/1.1 200 OK</a:status> <a:prop> <d:customerid>1049306</d:customerid> <e:professioncode b:dt="mv.string"> <c:v>byggtapetserarbeider</c:v>
6
2156
by: Mark Miller | last post by:
I have a scheduled job that uses different XSL templates to transform XML and save it to disk. I am having problems with the code below. The problem shows up on both my development machine (Windows XP Pro SP 1, .Net Framework 1.1) and on our production server (Windows 2K SP 4, .Net Framework 1.1). I have simplified the code and data to isolate the problem. When I use the xsl:strip-space (Line 12) declaration in conjunction with the xsl:sort...
6
1729
by: dave | last post by:
I really have 2 questions regarding the following xml snippet. The xml is a directory representation. <?xml version="1.0" standalone="yes"?> <FileSystem> <Row> <ID>1</ID> <Name>Root</Name> <Directory>Root</Directory> <Dir>true</Dir>
0
1073
by: Patrick.O.Ige | last post by:
I have a xml file and i want to format it using XSL I needed to do a distinct which is ok on the first node "Code" But when it gets to the "programDescription" node it prints out values for both Code="PRG004" and PRG005 which is CrazyTraining 2 and Program6 I want CrazyTraining 2 for PRG004 and Program6 for PRG005 Any help? Thx
1
1713
by: sommarlov | last post by:
Hi everyone >From one of our systems an xml file is produced. I need to validate this file before we send it to an external system for a very lenghty process. I cannot change the xml file layout. The solution i got today is very slow, and i need help to find another solution. Here is the xml file. It consists of a list of position ids (ESTOXX50 INDEX_BM_E and FTSE INDEX_BM_E), and below that a list of tags for each position id. What i...
0
8251
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8182
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8688
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8494
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7178
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6115
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4085
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2614
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1800
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.