Re: [docbook-apps] Customizing the process.image template

2012-06-08 Thread Bob Stayton

Hi David,
No need to call 'process.image' again.  Since you have already copied it to your 
customization layer, you can just add the extra element there.  Put it after these 
lines:


   xsl:otherwise
 xsl:copy-of select=$img/
   /xsl:otherwise
 /xsl:choose

which is just before the map element would be output for an imagemap, or at the very 
end of the template.


Bob Stayton
Sagehill Enterprises
b...@sagehill.net


- Original Message - 
From: David Goss dg...@mueller-inc.com

To: DocBook Apps docbook-apps@lists.oasis-open.org
Sent: Friday, June 08, 2012 8:42 AM
Subject: [docbook-apps] Customizing the process.image template


Hi,

I'm using the [Lazy Load](http://www.appelsiini.net/projects/lazyload)
JQuery plugin to help out on some image-heavy docbook articles. I
basically just copy/pasted the process.image template to my
customization later and made these changes (data-original was src
and the last two attributes are my additions):

xsl:attribute name=data-original
  xsl:choose
xsl:when test=$img.src.path != '' and $tag = 'img' and
not(starts-with($output_filename, '/')) and
not(contains($output_filename, '://'))
  xsl:value-of select=$img.src.path/
/xsl:when
  /xsl:choose
   xsl:value-of select=$output_filename/
 /xsl:attribute

xsl:attribute
name=src../img/common/placeholder.png/xsl:attribute
xsl:attribute name=classlazy/xsl:attribute

It works just fine, that's not the problem. I want to make it degrade
gracefully (without JavaScript, only the placeholder image is
displayed). The way the plugin author recommends to do so is the place
an alternative in a noscript tag after the image, like this:

img class=lazy src=img/placeholder.png
data-original=img/realimage.jpg
noscriptimg src=img/realimage.jpg/noscript

My question is where/how in the process.image template should this
redundant image be added? (Perhaps I need to call process.image twice in
the imagedata template, then have some sort of condition in
process.image to determine whether to swap src and data-original?)


DAVID GOSS | Technical Writer
P 1.800.876.9218 x 345 | F 1.800.588.9866
dg...@mueller-inc.com
http://www.MuellerReports.com



-
To unsubscribe, e-mail: docbook-apps-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-h...@lists.oasis-open.org




-
To unsubscribe, e-mail: docbook-apps-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-h...@lists.oasis-open.org



RE: [docbook-apps] Customizing the process.image template

2012-06-08 Thread David Goss
Thank you Bob, that was the exact place I need to add the code I wanted.
It works perfectly now.

-David
dg...@mueller-inc.com

-Original Message-
From: Bob Stayton [mailto:b...@sagehill.net] 
Sent: Friday, June 08, 2012 1:00 PM
To: David Goss; DocBook Apps
Subject: Re: [docbook-apps] Customizing the process.image template

Hi David,
No need to call 'process.image' again.  Since you have already copied it
to your customization layer, you can just add the extra element there.
Put it after these
lines:

xsl:otherwise
  xsl:copy-of select=$img/
/xsl:otherwise
  /xsl:choose

which is just before the map element would be output for an imagemap,
or at the very end of the template.

Bob Stayton
Sagehill Enterprises
b...@sagehill.net


- Original Message -
From: David Goss dg...@mueller-inc.com
To: DocBook Apps docbook-apps@lists.oasis-open.org
Sent: Friday, June 08, 2012 8:42 AM
Subject: [docbook-apps] Customizing the process.image template


Hi,

I'm using the [Lazy Load](http://www.appelsiini.net/projects/lazyload)
JQuery plugin to help out on some image-heavy docbook articles. I
basically just copy/pasted the process.image template to my
customization later and made these changes (data-original was src
and the last two attributes are my additions):

 xsl:attribute name=data-original
   xsl:choose
 xsl:when test=$img.src.path != '' and $tag = 'img' and
not(starts-with($output_filename, '/')) and
not(contains($output_filename, '://'))
   xsl:value-of select=$img.src.path/
 /xsl:when
   /xsl:choose
xsl:value-of select=$output_filename/
  /xsl:attribute

xsl:attribute
name=src../img/common/placeholder.png/xsl:attribute
xsl:attribute name=classlazy/xsl:attribute

It works just fine, that's not the problem. I want to make it degrade
gracefully (without JavaScript, only the placeholder image is
displayed). The way the plugin author recommends to do so is the place
an alternative in a noscript tag after the image, like this:

img class=lazy src=img/placeholder.png
data-original=img/realimage.jpg
noscriptimg src=img/realimage.jpg/noscript

My question is where/how in the process.image template should this
redundant image be added? (Perhaps I need to call process.image twice in
the imagedata template, then have some sort of condition in
process.image to determine whether to swap src and data-original?)


DAVID GOSS | Technical Writer
P 1.800.876.9218 x 345 | F 1.800.588.9866
dg...@mueller-inc.com
http://www.MuellerReports.com



-
To unsubscribe, e-mail: docbook-apps-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-h...@lists.oasis-open.org




-
To unsubscribe, e-mail: docbook-apps-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-h...@lists.oasis-open.org