[Libreoffice-commits] core.git: writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Fri Mar 7 02:53:25 PST 2014
writerfilter/source/ooxml/factoryimpl.xsl | 3 ++-
writerfilter/source/ooxml/model.xml | 2 ++
writerfilter/source/ooxml/namespaceids.xsl | 3 ++-
3 files changed, 6 insertions(+), 2 deletions(-)
New commits:
commit f9bf15e19ec823a58ee32bf94da81f3bb1a147bc
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Fri Mar 7 11:45:39 2014 +0100
writerfilter: initial strict DOCX support
The generate-id() code is just necessary avoid duplicated elements in
the for-each loop. http://mahahegde.com/xslt-distinct-values/ has a
detailed description of the technique used here.
Change-Id: I647efe9d4a0834d3756fe9fa6d706ba6ba4e00f1
diff --git a/writerfilter/source/ooxml/factoryimpl.xsl b/writerfilter/source/ooxml/factoryimpl.xsl
index 0ac9e56..2fb5139 100644
--- a/writerfilter/source/ooxml/factoryimpl.xsl
+++ b/writerfilter/source/ooxml/factoryimpl.xsl
@@ -196,6 +196,7 @@ uno::Reference< xml::sax::XFastContextHandler > OOXMLFactory::createFastCh
</xsl:text>
</xsl:template>
+<xsl:key name="namespaces-by-id" match="namespace-alias" use="@id"/>
<xsl:template name="fasttokentoid">
<xsl:text>
namespace tokenmap {
@@ -217,7 +218,7 @@ string fastTokenToId(sal_uInt32 nToken)
switch (nToken & 0xffff0000)
{</xsl:text>
- <xsl:for-each select="//namespace-alias">
+ <xsl:for-each select="//namespace-alias[generate-id() = generate-id(key('namespaces-by-id', @id)[1])]">
<xsl:text>
case NS_</xsl:text>
<xsl:value-of select="@alias"/>
diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml
index 70289f5..12c47c4 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -23,6 +23,7 @@
<namespace-alias name="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" alias="theme" id="officeRelTheme"/>
<namespace-alias name="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" alias="wordprocessingDrawing" id="dmlWordDr"/>
<namespace-alias name="http://schemas.openxmlformats.org/drawingml/2006/main" alias="drawingml" id="dml"/>
+ <namespace-alias name="http://purl.oclc.org/ooxml/drawingml/main" alias="drawingml" id="dml"/>
<namespace-alias name="urn:schemas-microsoft-com:vml" alias="vml" id="vml"/>
<namespace-alias name="http://schemas.openxmlformats.org/drawingml/2006/picture" alias="picture" id="dmlPicture"/>
<namespace-alias name="http://schemas.openxmlformats.org/drawingml/2006/diagram" alias="diagram" id="dmlDiagram"/>
@@ -32,6 +33,7 @@
<namespace-alias name="http://schemas.openxmlformats.org/drawingml/2006/chart" alias="chart" id="dmlChart"/>
<namespace-alias name="urn:schemas-microsoft-com:office:word" alias="vml_wordprocessingDrawing" id="vmlWord"/>
<namespace-alias name="http://schemas.openxmlformats.org/wordprocessingml/2006/main" alias="wordprocessingml" id="doc"/>
+ <namespace-alias name="http://purl.oclc.org/ooxml/wordprocessingml/main" alias="wordprocessingml" id="doc"/>
<namespace-alias name="http://schemas.openxmlformats.org/officeDocument/2006/math" alias="math" id="officeMath"/>
<namespace-alias name="http://schemas.openxmlformats.org/schemaLibrary/2006/main" alias="schemaLibrary" id="schema"/>
<namespace-alias name="http://schemas.openxmlformats.org/markup-compatibility/2006" alias="mce" id="mce"/>
diff --git a/writerfilter/source/ooxml/namespaceids.xsl b/writerfilter/source/ooxml/namespaceids.xsl
index ea56acc..d92593d 100644
--- a/writerfilter/source/ooxml/namespaceids.xsl
+++ b/writerfilter/source/ooxml/namespaceids.xsl
@@ -51,8 +51,9 @@
<xsl:include href="factorytools.xsl"/>
+<xsl:key name="namespaces-by-id" match="namespace-alias" use="@id"/>
<xsl:template name="namespaceids">
- <xsl:for-each select="//namespace-alias">
+ <xsl:for-each select="//namespace-alias[generate-id() = generate-id(key('namespaces-by-id', @id)[1])]">
<xsl:text>
const sal_uInt32 </xsl:text>
<xsl:call-template name="namespaceid"/>
More information about the Libreoffice-commits
mailing list