On Sun, Nov 24, 2002 at 10:16:13PM +0100, Bart Schuller wrote: > On Sun, Nov 24, 2002 at 09:50:40PM +0100, Steinar Bang wrote: > > What's the proper way to select a different <imageobject> for HTML and > > XSL:FO, in a <mediaobject> containing two PNGs? (actually the same > > PNG but with different scaling)
The current XSL stylesheet process uses the first acceptable *object element within a mediaobject. By default, "acceptable" means the filename extension appears in a list of filename extensions for that processor. > I'm currently doing it by using GIF for HTML and PNG for FO, which > happens to "just work". Well, this lucky trick won't work if you switch to XEP for your FO processing because XEP accepts GIF as well. Check out the 'graphic.extensions' parameter defined in fo/graphics.xsl to see which extensions are acceptable for each fo processor. > But the doubled images both on disk and in authoring environments bother > me too, so I'm contemplating only keeping the <imagedata> elements with > scaling and write a simple XSLT file to make a copy but without the > scaling info. The copy would then be transformed to HTML, the original > to FO. > > Now that I'm writing it down like this, it could also be solved by > introducing a new parameter to the HTML transform, something like > "disable-image-scaling". > > I've just added it as Feature Request 643237 on sourceforge. Another way would be to keep the two <imageobject> elements, add role values to them, and customize the 'is.acceptable.mediaobject' template found in common/common.xsl. That template is used when there is more than one imageobject in a mediaobject. The template returns '1' if an imageobject is acceptable, or '0' if not. If '0', then the processor tries the next imageobject within the mediaobject. You could customize 'is.acceptable.mediaobject' for HTML by copying the whole template to your HTML customization layer and changing the final xsl:choose statement to start with: <xsl:choose> <xsl:when test="$object/@role = 'fo'">0</xsl:when> ... By returning zero, the HTML stylesheet rejects any imageobjects whose role="fo". Do the reverse for your FO customization layer, rejecting role="html" imageobjects. -- Bob Stayton 400 Encinal Street Publications Architect Santa Cruz, CA 95060 Technical Publications voice: (831) 427-7796 The SCO Group fax: (831) 429-1887 email: [EMAIL PROTECTED]