[Standards] Images in XEPs

Peter Waher Peter.Waher at clayster.com
Fri Nov 1 16:39:09 UTC 2013


Hello

Resending this. Could anybody solve this?

Compare for instance viewing the following URL in IE vs. Firefox:
http://xmpp.org/extensions/xep-0323.html

I noticed all graphs in our XEPs have fallen away in Internet Explorer. The reason is <img> tags are rendered with width="" and height="". In Firefox these attributes are ignored, and images shown, but in IE it is interpreted as width="0" height="0".

The reason is the xep.xsl file does not match the schema file for xeps. The schema file prohibits width and height attributes, so you cannot add them to the xeps without getting schema validation errors. The xep.xsl file however, uses copies these attributes to the image tag without first checking if they exist.

One solution is to comment away the width and height attributes:

  <xsl:template match='img'>
    <img>
      <xsl:attribute name='alt'><xsl:value-of select='@alt'/></xsl:attribute>
      <!--<xsl:attribute name='height'><xsl:value-of select='@height'/></xsl:attribute>-->
      <xsl:attribute name='src'><xsl:value-of select='@src'/></xsl:attribute>
      <!--<xsl:attribute name='width'><xsl:value-of select='@width'/></xsl:attribute>-->
    </img>
  </xsl:template>

Another would be to include a test to see if the attributes are there before copying them:

  <xsl:template match='img'>
      <img>
          <xsl:attribute name='alt'>
              <xsl:value-of select='@alt'/>
          </xsl:attribute>
          <xsl:if test='@height'>
              <xsl:attribute name='height'>
                  <xsl:value-of select='@height'/>
              </xsl:attribute>
          </xsl:if>
          <xsl:attribute name='src'>
              <xsl:value-of select='@src'/>
          </xsl:attribute>
          <xsl:if test='@width'>
              <xsl:attribute name='width'>
                  <xsl:value-of select='@width'/>
              </xsl:attribute>
          </xsl:if>
      </img>
  </xsl:template>

The latter would generate existing xeps that have the attributes as they are generated today, and those that do not have the attributes as well.

Could you please look at this? We have embedded diagrams in many of our proposals that now are not visible if you use Internet Explorer.

Thanks in advance,
Peter Waher

-----Original Message-----
From: Peter Waher 
Sent: den 22 mars 2013 11:14
To: standards at xmpp.org
Subject: RE: [Standards] Proposed XMPP Extension: XEP - Sensor Networks - Provisioning

Excellent.

A small note to interested parties: This proposal contains diagrams (as does the Sensor-Data proposal). These are unfortunately not seen if viewed with Internet Explorer. Mozilla-based browsers display them though.

The reason is the following: img-tags available in the XEP XML are not allowed to contain width and height attributes according to the XEP schema. However, in the XSL (XML->HTML) transformation, img tags are created copying the (non-existing) width and height attributes to HTML. This results in img-tags of the following type: <img src='...' wdith='' height=''/>. This in turn is interpreted by Internet Explorer as meaning width='0' height='0', making the image invisible. Mozilla-based browser in turn interpret this as if the attributes are not defined, making the image visible.

Commenting out these two attributes (or making them conditional using xsl:if) in the xsl file before generating the HTML would also resolve the issue:

  <xsl:template match='img'>
    <img>
      <xsl:attribute name='alt'><xsl:value-of select='@alt'/></xsl:attribute>
      <!--<xsl:attribute name='height'><xsl:value-of select='@height'/></xsl:attribute>-->
      <xsl:attribute name='src'><xsl:value-of select='@src'/></xsl:attribute>
      <!--<xsl:attribute name='width'><xsl:value-of select='@width'/></xsl:attribute>-->
    </img>
  </xsl:template>

Sincerely,
Peter Waher


-----Original Message-----
From: XMPP Extensions Editor [mailto:editor at xmpp.org] 
Sent: den 21 mars 2013 12:37
To: standards at xmpp.org
Subject: [Standards] Proposed XMPP Extension: XEP - Sensor Networks - Provisioning

The XMPP Extensions Editor has received a proposal for a new XEP.

Title: XEP - Sensor Networks - Provisioning

Abstract: This specification describes an architecture for efficient provisioning of services, access rights and user privileges in sensor networks.

URL: http://xmpp.org/extensions/inbox/sensor-network-provisioning.html

The XMPP Council will decide in the next two weeks whether to accept this proposal as an official XEP.





More information about the Standards mailing list