Skip to content

Fix bug in subsurface XML to DivelogsDE XML export parsing.#4747

Merged
mikeller merged 1 commit intosubsurface:masterfrom
vigge93:divelogsde-decimal-volume
Mar 20, 2026
Merged

Fix bug in subsurface XML to DivelogsDE XML export parsing.#4747
mikeller merged 1 commit intosubsurface:masterfrom
vigge93:divelogsde-decimal-volume

Conversation

@vigge93
Copy link
Copy Markdown
Contributor

@vigge93 vigge93 commented Mar 10, 2026

When calculating the volume of tanks with fractional values, the division in the XSLT template causes a comma to be used as the decimal separator instead of a period.

This is fixed by explicitly converting the result with a known format string.

Describe the pull request:

  • Bug fix
  • Functional change
  • New feature
  • Code cleanup
  • Build system change
  • Documentation change
  • Language translation

Pull request long description:

Changes made:

  1. Explicitly cast tank volume using known decimal format.

Related issues:

Additional information:

Documentation change:

Mentions:

When calculating the volume of tanks with fractional values, the division in the XSLT template causes a comma to be used as the decimal separator instead of a period.

This is fixed by explicitly converting the result with a known format string.

Signed-off-by: Victor Arvidsson <[email protected]>
@github-actions
Copy link
Copy Markdown

Artifacts:
Subsurface-Linux-AppImage-6.0.5569-patch.1.pull-request.divelogsde-decimal-volume
WARNING: Use at your own risk.

@github-actions
Copy link
Copy Markdown

Artifacts:
Subsurface-Android-6.0.5569-patch.1.pull-request.divelogsde-decimal-volume
WARNING: Use at your own risk.

@github-actions
Copy link
Copy Markdown

Artifacts:
Subsurface-Windows-MSVC-qt-6-6.0.5569-patch.1.pull-request.divelogsde-decimal-volume
WARNING: Use at your own risk.

@github-actions
Copy link
Copy Markdown

Artifacts:
Subsurface-Windows-6.0.5569-patch.1.pull-request.divelogsde-decimal-volume
WARNING: Use at your own risk.

@glance-
Copy link
Copy Markdown
Collaborator

glance- commented Mar 10, 2026

Guessing this was locale dependant, and this was ever only tested in locales which use . as decimal separator.

LGTM

Copy link
Copy Markdown
Member

@mikeller mikeller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good find.

There are other places in this template where we are returning fractional numbers, that may or may not cause errors when importing in DivelogsDE.

I think it will be a better approach to set the global format for fractional numbers at the top of the file with

<xsl:decimal-format decimal-separator="."/>

@vigge93
Copy link
Copy Markdown
Contributor Author

vigge93 commented Mar 13, 2026

Good find.

There are other places in this template where we are returning fractional numbers, that may or may not cause errors when importing in DivelogsDE.

I think it will be a better approach to set the global format for fractional numbers at the top of the file with

<xsl:decimal-format decimal-separator="."/>

From what I've found, the <xsl:decimal-format ... /> is only used in the format-number() function, and is only useful if the specified format follows a different format from the default for format-number(). Since we want the default (.), <xsl:decimal-format /> is not useful.

Also, I think this is the only place in the template where the value is actually converted to a number, the other values are substrings, and are treated as string throughout the transformation.

@vigge93 vigge93 requested a review from mikeller March 14, 2026 13:05
@mikeller mikeller merged commit 3d180ee into subsurface:master Mar 20, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants