This patch adds image support to UDDF export. As far as I can tell from
the UDDF specification, the images can only be added to notes field, so
that is what we do here. (buddy and owner can also have image tags, but
that is irrelevant for Subsurface currently.)

Signed-off-by: Miika Turkia <[email protected]>
---
 xslt/uddf-export.xslt | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/xslt/uddf-export.xslt b/xslt/uddf-export.xslt
index 0de8b49..285f3c2 100644
--- a/xslt/uddf-export.xslt
+++ b/xslt/uddf-export.xslt
@@ -4,6 +4,7 @@
   <xsl:output method="xml" encoding="utf-8" indent="yes"/>
 
   <xsl:key name="gases" match="cylinder" use="concat(substring-before(@o2, 
'.'), '/', substring-before(@he, '.'))" />
+  <xsl:key name="images" match="picture" 
use="concat(../../dive/@number|../dive/@number, ':', @filename, '@', @offset)" 
/>
 
   <xsl:template match="/divelog/dives">
     <uddf version="3.2.0">
@@ -21,6 +22,15 @@
           </datetime>
         </xsl:if>
       </generator>
+      <mediadata>
+        <xsl:for-each select="//picture[generate-id() = 
generate-id(key('images', concat(../../dive/@number|../dive/@number, ':', 
@filename, '@', @offset))[1])]">
+          <image id="{concat(../../dive/@number|../dive/@number, ':', 
@filename, '@', @offset)}">
+            <objectname>
+              <xsl:value-of select="@filename"/>
+            </objectname>
+          </image>
+        </xsl:for-each>
+      </mediadata>
 
       <diver>
         <owner id="1">
@@ -456,6 +466,9 @@
           <para>
             <xsl:value-of select="notes"/>
           </para>
+          <xsl:for-each select="picture">
+            <link ref="{concat(../@number, ':', @filename, '@', @offset)}"/>
+          </xsl:for-each>
         </notes>
         <rating>
           <ratingvalue>
-- 
1.9.1

_______________________________________________
subsurface mailing list
[email protected]
http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to