[xml/sgml] Re: Bug#382505: fo output does not respect /etc/papersize

Daniel Leidert daniel.leidert.spam at gmx.net
Wed Aug 16 01:39:57 UTC 2006


* CCed BTS, the list and the discussion members of bug#173093 *

Am Freitag, den 11.08.2006, 18:34 +0200 schrieb W. Borgert:
> Quoting Daniel Leidert <daniel.leidert.spam at gmx.net>:

[docbook-xsl: fo-output and /etc/papersize]
> > Not sure, how difficult this will be or if it will be possible in the
> > way I think of it. It will need some sort of script to realize it. I
> 
> [..]
> What kind of solution do you have in mind?

After searching and reading a while ..

With XSLT 2.0 there is an unparsed-text() function, that can be used to
read in the content of /etc/papersize and assign it to a variable.
Simply:

<xsl:variable name="system.paper.type" select="unparsed-text('/etc/papersize')"/>

Then this variable can be evaluated and the page.type parameter can be
set accordingly.

The big problem: This function is currently not implemented (libxslt1.1
does not contain an implementation and saxon implements it with version
7.3, but we have 6.5.5; no idea about xalan atm).

I tried a replacement, looking like this:

<xsl:variable name="system.paper.type">
  <xi:include href="file:///etc/papersize" parse="text" encoding="iso-8859-1">
    <xi:fallback>
      <xsl:message>xinclude error: file not found</xsl:message>
    </xi:fallback>
  </xi:include>
</xsl:variable>

but it always outputs 'xinclude error: file not found' (independent from
using a file://-handler or not). I guess, libxslt (I test with xsltproc)
does not know the xi:include element here.

So the only possibility atm [1] seems to be to "rewrite" /etc/papersize
(as /etc/papersize.xml) as XML-file (just adding a fake-element about
it's content) and then importing the content using document(). The
creation of the XML-version of /etc/papersize must IMO be done a) with a
script and cron or b) with an extension. The latter one is IMO only
possible using Java.

Any ideas or opinions?

[1] I'm still in discussion, how this could be realized, but it seems,
an easy solution (using e.g. the XSLT 2.0 function) is impossible atm.

Regards, Daniel




More information about the Debian-xml-sgml-devel mailing list