docbook-apps

  • 1.  Setting width for mediaobject in EPUB

    Posted 01-18-2013 14:34
    I'm specifying the width of an image using the <imagedata> attribute
    'width' (and I've also tried 'contentwidth'). When I transform to an
    EPUB 3, I get the width coded as a style attribute:

    alt text for  <br/>Creative Commons licence logo

    The image doesn't render to a width of 150px. But removing the style
    setting and replacing it with the img attribute 'width' does work. Where
    do I find the stylesheet coding that sets style="width: ; ". I've looked
    in XHTML1-1/graphics.xsl and there's nothing obvious that sets the style
    attribute with a value of 'width' (all instance of 'style' refer to
    text-align).
    --
    *Dave Gardiner*




  • 2.  Re: [docbook-apps] Setting width for mediaobject in EPUB

    Posted 01-18-2013 17:54
    Hi Dave,
    The status of the width and many other attributes changed in HTML5, which is what Epub3 is based on. For most HTML5 elements, the width attribute is deprecated, and should be replaced with the CSS style. In an earlier draft of HTML5, that was true for img as well. However, the latest draft shows that width and height attributes are permitted on img.

    The xhtml5 stylesheet is a customization of the DocBook xhtml stylesheet. To handle these deprecated attributes, there is a template with match="*" in mode="convert.to.style" that rewrites the deprecated attributes as parts of a style attribute for an HTML element. That template is in xhtml5/html5-element-mods.xsl. You will see that it includes width.

    Since this is a mode, we should be able to add a template with match="x:img" (the x: namespace is the XHTML namespace) and change that behavior so width is output for img. However, I'm not sure it is that easy, since width is also involved with creating a viewport for an image. I'll look into it.

    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net


    From: Xmplar
    Sent: Friday, January 18, 2013 6:33 AM
    To: DocBook Apps
    Subject: [docbook-apps] Setting width for mediaobject in EPUB


    I'm specifying the width of an image using the <imagedata> attribute 'width' (and I've also tried 'contentwidth'). When I transform to an EPUB 3, I get the width coded as a style attribute:

    alt text for Creative Commons licence logo

    The image doesn't render to a width of 150px. But removing the style setting and replacing it with the img attribute 'width' does work. Where do I find the stylesheet coding that sets style="width: ; ". I've looked in XHTML1-1/graphics.xsl and there's nothing obvious that sets the style attribute with a value of 'width' (all instance of 'style' refer to text-align).

    --
    Dave Gardiner




  • 3.  Re: [docbook-apps] Setting width for mediaobject in EPUB

    Posted 01-19-2013 00:50
    Bob,
    According to the specs, I believe that width and height *may* be
    permitted on . These should actually be the default, or at least a
    parameterized option, for DocBook.
    I'm testing my HTML pages in the latest Firefox - if images don't appear
    sized correctly (i.e. as they are coded in the xml with 'width' or
    'contentwidth') then it means a lot of post-processing of the HTML. I'd
    rather have images turn out the size that I specify (funnily enough),
    and 'width' inside 'style' doesn't work.


    On 19-01-13 4:54 AM, Bob Stayton wrote:
    > Hi Dave,
    > The status of the width and many other attributes changed in HTML5,
    > which is what Epub3 is based on. For most HTML5 elements, the width
    > attribute is deprecated, and should be replaced with the CSS style.
    > In an earlier draft of HTML5, that was true for img as well. However,
    > the latest draft shows that width and height attributes are permitted
    > on img.
    > The xhtml5 stylesheet is a customization of the DocBook xhtml
    > stylesheet. To handle these deprecated attributes, there is a
    > template with match="*" in mode="convert.to.style" that rewrites the
    > deprecated attributes as parts of a style attribute for an HTML
    > element. That template is in xhtml5/html5-element-mods.xsl. You
    > will see that it includes width.
    > Since this is a mode, we should be able to add a template with
    > match="x:img" (the x: namespace is the XHTML namespace) and change
    > that behavior so width is output for img. However, I'm not sure it is
    > that easy, since width is also involved with creating a viewport for
    > an image. I'll look into it.
    > Bob Stayton
    > Sagehill Enterprises
    > bobs@sagehill.net <mailto:bobs@sagehill.net>
    >
    > *From:* Xmplar <mailto:info@xmplar.biz>
    > *Sent:* Friday, January 18, 2013 6:33 AM
    > *To:* DocBook Apps <mailto:docbook-apps@lists.oasis-open.org>
    > *Subject:* [docbook-apps] Setting width for mediaobject in EPUB
    >
    > I'm specifying the width of an image using the <imagedata> attribute
    > 'width' (and I've also tried 'contentwidth'). When I transform to an
    > EPUB 3, I get the width coded as a style attribute:
    >
    > alt text for  <br/>> Creative Commons licence logo
    >
    > The image doesn't render to a width of 150px. But removing the style
    > setting and replacing it with the img attribute 'width' does work.
    > Where do I find the stylesheet coding that sets style="width: ; ".
    > I've looked in XHTML1-1/graphics.xsl and there's nothing obvious that
    > sets the style attribute with a value of 'width' (all instance of
    > 'style' refer to text-align).
    > --
    > *Dave Gardiner*
    >

    --
    *Dave Gardiner*