You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lenya.apache.org by Richard Schottdorf <sc...@screenwave.de> on 2005/11/22 14:53:06 UTC

RE: Lenya 1.2, Kupu, BXE and image alignment

 
Hi,

I made it quite a while ago to get an ID attribute for my objects on my
windows production server.
But as soon as I put my publications on the linux server the id attribute
for objects is not available.

The modifications described by Jon are made. Has anyone any idea how I may
fix this problem?

Greetings
Richard


> Hi,
>
> I seem to be unable to insert images into the Default publication
> of a lenya 1.2.x SVN checkout from about 2 weeks ago.
>
> In Kupu, I have the choice between left, right and inline, but
> neither as any effect - after saving, the image has no class- or
> align-attribute.
>
> In BXE, the image object has a lot of attributes, but again
> neither class nor align. So again, no chance to align it somehow.
>
> Am I doing something wrong? The wish to align an image seems
> rather basic to me, so I am puzzled...
>
> Have a nice weekend

Yeah, I found this out the hard way myself.  Here's what I did to
fix it:

1.  Go to lenya/resources/kupu/apache-lenya/lenya/ and edit the
file kupusave.xsl.  You should see a chunk like the following:

<!-- this template converts the img tag to object
  for more, see http://www.xml.com/pub/a/2003/07/02/dive.html -->
<xsl:template match="xhtml:img">
   <object>
     <xsl:attribute name="data">

Towards the bottom, you'll see a couple of <xsl:if> statements
for the attributes @height and @width.  Copy one of them as a
template and replace it with @class.  So your bottom section will
look like this:

         <xsl:if test="string(@height)">
          <xsl:attribute name="height">
            <xsl:value-of select="@height"/>
          </xsl:attribute>
        </xsl:if>
        <xsl:if test="string(@width)">
          <xsl:attribute name="width">
            <xsl:value-of select="@width"/>
          </xsl:attribute>
        </xsl:if>
        <xsl:if test="string(@class)">
          <xsl:attribute name="class">
            <xsl:value-of select="@class"/>
          </xsl:attribute>
        </xsl:if>

Save the file.

2.  You'll see something similar in a file called content2edit.xsl,
which is in the same directory as number 1.  Make the same change
by adding in a check for the class attribute.  Save.

3.  Lastly, you'll need to go into each publication you have and
edit the file xslt/xhtml2xhtml.xsl.  Take a look at the patch of
XSL that starts like this:

   <xsl:template name="object2img">
      <img border="0">
        <xsl:attribute name="src">
          <xsl:choose>
            <xsl:when test="not(starts-with(@data, '/'))">

First off, I like removing the border="0" attribute from the image
tag above.  I don't like the assumption that it needs to be there.
I just like assigning a class to the image and assuming that the
CSS will handle whether or not a border exists.

Secondly, just like you did with the above two points, add a new
section for @class.  You can copy one of the <xsl:if> statements
from @height and @width as templates.  Save.

Now you're all set to have classes assigned to your image when you
save out of Kupu (and presumably Bitflux).  If you don't like the
default class names that Kupu uses, then you can go into the files
lenya/resources/kupu/common/kupubasetools.js and
lenya/resources/kupu/common/kupudrawers/drawer.xsl and search for
the default class names of "image-left", "image-right", and
"image-inline" and replace them with whatever you choose.  Be sure
to add the classes you create in your CSS so that they float
properly and have the appropriate styles.

Hope this helps!
Jon


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org