Bug 409411 - Export to XHTML generates empy html file
Summary: Export to XHTML generates empy html file
Alias: None
Product: umbrello
Classification: Applications
Component: exporter (show other bugs)
Version: 2.28.2 (KDE Applications 19.04.2)
Platform: Other All
: NOR normal
Target Milestone: ---
Assignee: Umbrello Development Group
Depends on:
Reported: 2019-07-02 11:30 UTC by Ralf Habacker
Modified: 2022-03-06 07:55 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 2.33.80 (KDE releases 22.03.80)


Note You need to log in before you can comment on or make changes to this bug.
Description Ralf Habacker 2019-07-02 11:30:32 UTC
1. start umbrello
2. add some classes to a class diagram
3. select menu entry "file->Export Model->Export model to XHTML"

The generated html (and docbook file) is empty

The generated html (and docbook file) should not be empty

Windows: 7
Comment 1 Ralf Habacker 2019-07-02 11:37:12 UTC
Git commit c6002b5c68592932a64bb194449d2e884725631f by Ralf Habacker.
Committed on 02/07/2019 at 11:36.
Pushed by habacker into branch 'Applications/19.04'.

Fix 'Export to XHTML generates empy html file'

Since the website www.oasis-open.org cannot provide the file sdocbook.dtd
and no existing "simple docbook" package is available, the relevant files
are embedded in the Umbrello source code and installed with it.
FIXED-IN:2.28.3 (KDE Applications 19.04.3)

M  +1    -7    umbrello/CMakeLists.txt
A  +10   -0    umbrello/docgenerators/CMakeLists.txt
M  +90   -0    umbrello/docgenerators/docbookgeneratorjob.cpp
A  +67   -0    umbrello/docgenerators/simple4125/sdbcent.mod
A  +89   -0    umbrello/docgenerators/simple4125/sdbhier.mod
A  +195  -0    umbrello/docgenerators/simple4125/sdbpool.mod
A  +331  -0    umbrello/docgenerators/simple4125/sdocbook-custom.dtd
A  +679  -0    umbrello/docgenerators/simple4125/sdocbook.css
A  +1569 -0    umbrello/docgenerators/simple4125/sdocbook.dtd
A  +60   -0    umbrello/docgenerators/simple4125/sdocbookref-custom.dtd
A  +1729 -0    umbrello/docgenerators/simple4125/sdocbookref.dtd
A  +303  -0    umbrello/docgenerators/simple4125/sinclist.mod

Comment 2 Oliver Kellogg 2022-02-27 20:41:19 UTC
(In reply to Ralf Habacker from comment #1)
> [...]
> https://commits.kde.org/umbrello/c6002b5c68592932a64bb194449d2e884725631f

The sections "actors", "usecases", "interfaces", "classes" in the generated docbook continue to be empty after that change:

<article role="specification">
  <section id="actors">
  <section id="usecases">
    <title>Use Cases</title>
  <section id="interfaces">
  <section id="classes">

umbrello/umldoc.cpp commit 847b6e0d (2017-02-20) set the supported UML version in XMI file header to 1.4:

@@ -2015,13 +2015,13 @@ void UMLDoc::saveToXMI1(QIODevice& file)
     QDateTime now = QDateTime::currentDateTime();
     root.setAttribute(QLatin1String("timestamp"), now.toString(Qt::ISODate));
     root.setAttribute(QLatin1String("verified"), QLatin1String("false"));
-    root.setAttribute(QLatin1String("xmlns:UML"), QLatin1String("http://schema.omg.org/spec/UML/1.3"));
+    root.setAttribute(QLatin1String("xmlns:UML"), QLatin1String("http://schema.omg.org/spec/UML/1.4"));

However, the umbrello/docgenerators/xmi2docbook.xsl continues to use

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

libxslt apparently performs a consistency check on the xmlns URI between the stylesheet and the XML input file.
On the version mismatch, xsltApplyStylesheet() does not return an error but silently refuses to carry out the transformations.
Comment 3 Oliver Kellogg 2022-02-27 21:44:13 UTC
Git commit de636719fdfc7245f5498ae9717cf4462dfaa01d by Oliver Kellogg.
Committed on 27/02/2022 at 21:42.
Pushed by okellogg into branch 'master'.

Address reopening https://bugs.kde.org/show_bug.cgi?id=409411#c2 ,
> [...]
> libxslt apparently performs a consistency check on the xmlns URI
> between the stylesheet and the XML input file.
> On the version mismatch, xsltApplyStylesheet() does not return an
> error but silently refuses to carry out the transformations.

- In the <xsl:stylesheet> attributes change
  for synchronizing with Umbrello versions since 2.21 (Apps 17.03.80).
- Other changes:
  - Remove whitespace at line ends.
  - Join Xpath expressions spread over two lines to single line.
  - In <xsl:template name="class">,
    - in <xsl:for-each> fix Xpath expression of "select";
    - in <xsl:if test="@xmi.id = $idvalue">,
      - at entity &packagename; <xsl:value-of> fix attribute name in
      - in <div role="push">,
        - fix typo at "Abstract";
        - at "Visibility" update ancient <xsl:if> expressions.
  - In <xsl:template name="attribute">,
    - at "Visibility" update ancient <xsl:if> expressions;
    - at "Default" remove non-ASCII/non-UTF8 unidentified characters.
  - In <xsl:template name="operation"> update ancient <xsl:if>
    expressions intended for decoding "visibility".

- Enclose additions of commit c6002b5 in #ifdef USE_SDOCBOOK_LOCAL_COPY.
  Reason: The docbook generation appears to function properly without
- In function run() :
  - Remove local variables for "write the XMI model in an in-memory
    char* string", they appear to be unused.
  - Test return value from xsltParseStylesheetFile(), xmlParseFile(),
    xsltApplyStylesheet() and log an error if null.
  - On freeing up pointers deallocate `cur' last.  Reason: Heap segments
    shall be freed in the opposite order of their allocation.
FIXED-IN:2.33.80 (KDE releases 22.03.80)

M  +30   -9    umbrello/docgenerators/docbookgeneratorjob.cpp
M  +230  -236  umbrello/docgenerators/xmi2docbook.xsl

Comment 4 Oliver Kellogg 2022-03-06 06:18:44 UTC
(In reply to Oliver Kellogg from comment #2)
> The sections "actors", "usecases", "interfaces", "classes" in the generated
> docbook continue to be empty after that change: [...]

This problem is fixed in the UML1 mode but in UML2 mode it persists.
Comment 5 Oliver Kellogg 2022-03-06 07:55:34 UTC
Git commit e1b1b501dc314d33d0b0c677f3a655d09d7863e5 by Oliver Kellogg.
Committed on 06/03/2022 at 07:54.
Pushed by okellogg into branch 'master'.

Address reopening https://bugs.kde.org/show_bug.cgi?id=409411#c4

> > The sections "actors", "usecases", "interfaces", "classes" in the
> > generated docbook continue to be empty after that change: [...]
> This problem is fixed in the UML1 mode but in UML2 mode it persists.

- Copy from xmi2docbook.xsl for use in UML1 mode.
- In <xsl:template name="actor"> <xsl:for-each> fix "select" expression.
- In <xsl:template name="usecase"> <xsl:for-each> fix "select" expr.

umbrello/docgenerators/xmi2docbook.xsl - adaptation to UML2 mode:
- In <xsl:stylesheet> replace
- In all <xsl:key> replace use="@xmi.id" by use="@xmi:id".
- In all <xsl:template>,
  - change namespace prefix "UML:" to "uml:".
  - replace select="@xmi.id" by select="@xmi:id";
  - change UML:Actor to packagedElement[@xmi:type = 'uml:Actor'];
  - change UML:UseCase to packagedElement[@xmi:type = 'uml:UseCase'];
  - change UML:Interface to packagedElement[@xmi:type ='uml:Interface'];
  - change UML:Class to packagedElement[@xmi:type = 'uml:Class'];
  - change UML:Generalization to generalization;
  - change UML:Classifier.feature/UML:Operation to ownedOperation;
  - change UML:Classifier.feature/UML:Attribute to ownedAttribute;
  - change UML:Attribute to ownedAttribute;
  - change UML:Operation to ownedOperation;
  - change UML:BehavioralFeature.parameter/UML:Parameter to
  - change UML:Parameter to ownedParameter.

- In function customXslFile set xslBaseName to "xmi1docbook.xsl" if
  Settings::optionState().generalState.uml2 is false.

- In function saveToXMI case Settings::optionState().generalState.uml2
  add writing of attribute "uml" with value
- In function loadFromXMI, if outerTag is "XMI" or "xmi:XMI" and
  versionString is "xmi.version" then set
  Settings::optionState().generalState.uml2 true if version is greater
  than or equal to 2.0.

- In install FILES add xmi1docbook.xsl.

- Increment XMI2_FILE_VERSION to "2.0.4" due to <xmi:XMI> added writing
  of attribute "xmlns:uml" (see UMLDoc::saveToXMI).
FIXED-IN: 2.33.80 (KDE releases 22.03.80)

M  +1    -0    umbrello/docgenerators/CMakeLists.txt
M  +7    -1    umbrello/docgenerators/docbookgenerator.cpp
C  +2    -2    umbrello/docgenerators/xmi1docbook.xsl [from: umbrello/docgenerators/xmi2docbook.xsl - 099% similarity]
M  +60   -61   umbrello/docgenerators/xmi2docbook.xsl
M  +4    -0    umbrello/umldoc.cpp
M  +1    -1    umbrello/version.h