[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Using Java in XSLT to determine font metrics


Subject: RE: [xsl] Using Java in XSLT to determine font metrics
From: Hermann Stamm-Wilbrandt <STAMMW@xxxxxxxxxx>
Date: Tue, 23 Dec 2008 11:24:56 +0100

> This is my first attempt at calling an external Java method
> to do work on behalf of  a stylesheet. I'm not a Java
> developer so I think I need a fairly complete "cookbook"
>  description of how to do this. My objective is to determine
> the exact length, in pixels,  of a given string based on the
> font and font size in play.
> ...
> ...
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
>     xmlns:FontMetrics="ext://java.awt.FontMetrics">
>     <xsl:output indent="yes"/>.
> ...

Your <xsl:output> statement does not contain a method attribute
and therefore defaults to 'html'.

Your objective might perhaps be solved alternatively on the
client side if relying on JavaScript is an option to you.

http://www.faqts.com/knowledge_base/view.phtml/aid/15770/fid/53
("How can you determine the width in pixels a string will
  occupy on screen?")


Hermann Stamm-Wilbrandt
Developer, XML Compiler
WebSphere DataPower SOA Appliances
----------------------------------------------------------------------
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschdftsf|hrung: Erich Baier
Sitz der Gesellschaft: Bvblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294


Current Thread
Keywords
xml