## More problems and questions

 Subject: More problems and questions From: "anilia bruho" Date: Sat, 09 Sep 2000 06:05:47 GMT
Some time ago I posted a question here concerning the
(im)possibility to use FO renderer information, such as the width of
a specific text line set in a specific font, in XSLT
transformations. Now, after reading a lot of specs and materials and
after getting some experience with real XML, I want to ask some more
specific questions.

1. Given that there exist FO renderer(s) written in Java, such as
FOP, and given that some XSLT processors, such as Saxon, allow
calling extension functions written in Java, is it possible to
access FO renderer from within XSLT through this mechanism, with the
goal of being able to ask the renderer some questions and give it
some tests and then modify the transformation algorithm based on the
results returned? An important point here is that the renderer being
accessed from within XSLT is the same as the one that will produce
the final output, therefore the results of calling the FO renderer
functions are guaranteed to be true to the final result. More
specifically,

- is this method workable in principle?

- if yes, is it possible to implement it right now, with current
versions of specs and software?

- if yes, which XSLT processor and FO renderer should be used?

2. I transform XML to HTML, and I want the stylesheet to
automatically insert width and height attributes in the img
elements. My idea is that it is possible to implement this by
calling extension functions implemented in Java which would open the
image file by its URI and return its dimentions (and perhaps some
other information, just in case). Has anyone tried this?
Is there any free code available?

3. In my custom TeX macro packages (they're intended for typesetting
mostly text with little code or math), I use \catcodes to enable
"smart" character macros. For instance, a hyphen in the input
expands into ~---, simple " quotes expand into alternating open and
closing typographic quotes, _something_ expands into {\it
something}. This saves a lot of typing, makes source text more
readable and editable, and moves the presentation aspect where it
belongs, i.e. in the stylesheet. Naturally, I would like to keep
using these simple abbreviations in XML/XSL too. As there are no
"character macros" in XSL, obviously what I need is some kind of an
input filter that will replace all hyphens in the text (not element
names or attributes) by &nbsp;&emdash;, _something_ by
<em>something</em> etc. Indeed, Saxon documentation says I can write
such a filter in Java. The problem, as with the previous question,
is that I'm not a Java programmer. What I probably would be able to
do is to take someone else's example of a simple search-and-replace
filter and adopt it to my needs. Therefore the question: Where can I
find such a working example, for Saxon or any other processor? Is
there perhaps an easier method to achieve this than coding in Java?

I would appreciate any pointers or suggestions.

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.