[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

More problems and questions 2

Subject: More problems and questions 2
From: "anilia bruho" <musoryanin@xxxxxxxxxxx>
Date: Mon, 18 Sep 2000 19:58:34 GMT
tex macro variable assignment
Thanks tp everyone for their comments. Here's my update:

> 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?

In general I'm not sure this is feasible.

OK, I'll have to drop this for now. But I really hope this bottleneck will be solved sometime in the future.


> 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?

I now have a Java class that implements this and works perfectly with Saxon. If anyone else needs it, please contact me.


> 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 ~---, .... As there are no
> "character macros" in XSL, obviously what I need is some kind of an
> input filter ... Indeed, Saxon documentation says I can write
> such a filter in Java.

I found a simpler solution: I create a template with match="text()", in it I assign the current node to a variable, perform the necessary search-and-replaces on it, and then output it using xsl:value-of. Works for me, so far. Some simple string processing can be done in XPath, and where its capabilities are not sufficient, I call some simple Java functions.


Now a new problem:

I need to create a table of contents by extracting all <head> elements from a number of XML files and listing them in the root file. For each file, I write

<xsl:for-each select="document($filename)//head">

But then, a problem arises. There are two things I need to do before inserting a table of contents entry:

1. Some heads contain markup, in particular they may have some words in <em>...</em>. I want this markup to be preserved in the table of contents.

2. I also need to do some text processing on the text of the heading: change capitalization and remove trailing punctuation ("." or "," which may be part of a heading in the text but should be dropped in the TOC).

To satisfy the first requirement, the only method that I found is using <xsl:copy-of> which copies a specified node with all subnodes. However, for the second requirement, the only way to go is to create a saxon:assignable variable, do the necessary processing on it and then output the result.

The problem is that these two approaches are not compatible. I can only go one way or the other. <xsl:copy-of> does not allow any changes to what it copies; on the other hand, a variable created from the current node converts it to string, so all non-text subnodes are lost.

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

Share information about yourself, create your own public profile at http://profiles.msn.com.


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.