Uploaded image for project: 'Ibexa IBX'
  1. Ibexa IBX
  2. IBX-4906

Changes in richtext namespaces causes markup to be lost during transformations

    XMLWordPrintable

Details

    • Ibexa Open Source

    Description

      In Ibexa 4.0, the namespaces in richtext was changed:

       

      in 3.3:

      <?xml version="1.0" encoding="UTF-8"?>
      <section xmlns="http://docbook.org/ns/docbook" xmlns:ezcustom="http://ez.no/xmlns/ezpublish/docbook/custom" xmlns:ezxhtml="http://ez.no/xmlns/ezpublish/docbook/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0-variant ezpublish-1.0">
         <section>
            <para ezxhtml:class="how_to_study">
               This is a <emphasis>italic</emphasis>
               test.
            </para>
         </section>
      </section>
       

      in 4.0 and later:

      <?xml version="1.0" encoding="UTF-8"?>
      <section xmlns="http://docbook.org/ns/docbook" xmlns:ezcustom="http://ibexa.co/xmlns/dxp/docbook/custom" xmlns:ezxhtml="http://ibexa.co/xmlns/dxp/docbook/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0-variant ezpublish-1.0">
         <section>
            <para ezxhtml:class="how_to_study">
               This is a <emphasis>italic</emphasis>          
               test.
            </para>
         </section>
      </section>
       

       

      The changes are 

      -xmlns:ezcustom="http://ez.no/xmlns/ezpublish/docbook/custom"
      -xmlns:ezxhtml="http://ez.no/xmlns/ezpublish/docbook/xhtml"
      +xmlns:ezcustom="http://ibexa.co/xmlns/dxp/docbook/custom"
      +xmlns:ezxhtml="http://ibexa.co/xmlns/dxp/docbook/xhtml" 

       

      The problem comes if you upgrade from 3.x or earlier versions. Then you'll have a mix of both namespaces, and the XSLT stylesheets (for instasnce src/bundle/Resources/richtext/stylesheets/docbook/xhtml5/edit/core.xsl is only dealing with the new namespace :

      <?xml version="1.0" encoding="UTF-8"?>
      <xsl:stylesheet
      (...)
          xmlns:ezxhtml="http://ibexa.co/xmlns/dxp/docbook/xhtml"
          xmlns:ezcustom="http://ibexa.co/xmlns/dxp/docbook/custom"
      (...)

       

      In XSLT the name of a namespace doesn't only include the "name" (ie xmlns:ezxhtml). The namespace name includes also the url, so xmlns:ezxhtml="http://ez.no/xmlns/ezpublish/docbook/xhtml" and xmlns:ezxhtml="http://ibexa.co/xmlns/dxp/docbook/xhtml" are considered as two different namespaces.

       

      As a result  the following XSLT code will do nothing if the document being converted has the old ez.no namespaces:

       <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet
      (...)
         xmlns:ezxhtml="http://ibexa.co/xmlns/dxp/docbook/xhtml"
         xmlns:ezcustom="http://ibexa.co/xmlns/dxp/docbook/custom"
      (...)
      <xsl:if test="@ezxhtml:class">
        <xsl:attribute name="class">
          <xsl:value-of select="@ezxhtml:class"/>
        </xsl:attribute>
      </xsl:if>
      
      

       

      That means that anyone who upgrades from 3.x or earlier versions looses any markup in the xmlns:ezxhtml and xmlns:ezcustom namespaces when editing content

       

      Due to this change, the following seems needed:

      • a migration script is needed for converting old new namespaces to the new ones. While at it, then also maybe replace ezxhtml and ezcustom with ibexaxhtml and  ibexacustom ?
      • The migration script will potentially run on huge databases so I think it needs to support multi concurrency (forking)
      • This affects how you use richtext via REST and PAPI, so documentation there also needs to be updated
      • Upgrade intructions needs to be updated

      Designs

        Attachments

          Activity

            People

              Unassigned Unassigned
              vidar.langseid@ibexa.co Vidar Langseid
              Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: