summaryrefslogtreecommitdiff
path: root/officecfg/util
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2003-03-26 12:59:19 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2003-03-26 12:59:19 +0000
commit5db03f52d7857c98fc55a6ec9bc6f12125a53dc8 (patch)
tree0b5b2ca22126c24b98cf17f9dcfbd8e1c3ea02c5 /officecfg/util
parent61bb4875c0b442030b649d9be22a724af17b8b4b (diff)
MWS_SRX644: migrate branch mws_srx644 -> HEAD
Diffstat (limited to 'officecfg/util')
-rw-r--r--officecfg/util/alllang.xsl98
-rw-r--r--officecfg/util/makefile.pmk36
-rw-r--r--officecfg/util/sanity.xsl12
-rw-r--r--officecfg/util/schema_val.xsl8
4 files changed, 61 insertions, 93 deletions
diff --git a/officecfg/util/alllang.xsl b/officecfg/util/alllang.xsl
index 6e84e594603f..76b06a311659 100644
--- a/officecfg/util/alllang.xsl
+++ b/officecfg/util/alllang.xsl
@@ -3,9 +3,9 @@
*
* $RCSfile: alllang.xsl,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: jb $ $Date: 2002-11-22 11:45:10 $
+ * last change: $Author: hr $ $Date: 2003-03-26 13:50:23 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -60,11 +60,11 @@
*
************************************************************************ -->
-<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:oor="http://openoffice.org/2001/registry"
- xmlns:filehelper="http://www.jclark.com/xt/java/org.openoffice.configuration.FileHelper"
+ xmlns:filehelper="http://www.jclark.com/xt/java/org.openoffice.configuration.FileHelper"
extension-element-prefixes="filehelper">
<!-- Get the correct format -->
@@ -81,12 +81,12 @@
<!--************************** TEMPLATES ******************************** -->
<!-- ensure that at least root is available -->
- <xsl:template match="/oor:node">
+ <xsl:template match="/oor:node">
<xsl:copy>
<xsl:choose>
<xsl:when test="string-length($locale)">
<xsl:apply-templates select = "@*" mode="locale"/>
- <xsl:apply-templates mode="locale"/>
+ <xsl:apply-templates mode="locale"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select = "@*" mode="non-locale"/>
@@ -99,31 +99,43 @@
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
- </xsl:copy>
+ </xsl:copy>
</xsl:template>
<!-- locale dependent data -->
- <xsl:template match="node|prop" mode = "locale">
- <xsl:if test="count(descendant::value[@xml:lang = $locale])">
- <xsl:copy>
- <xsl:apply-templates select = "@*" mode="locale"/>
- <xsl:apply-templates mode = "locale"/>
- </xsl:copy>
- </xsl:if>
+ <xsl:template match="node|prop" mode = "locale">
+ <xsl:choose>
+ <xsl:when test="$locale=$fallback-locale">
+ <xsl:if test="count(descendant::value[@xml:lang=$locale]/../value[not (@xml:lang)])">
+ <xsl:copy>
+ <xsl:apply-templates select = "@*" mode="locale"/>
+ <xsl:apply-templates mode = "locale"/>
+ </xsl:copy>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="count(descendant::value[@xml:lang = $locale])">
+ <xsl:copy>
+ <xsl:apply-templates select = "@*" mode="locale"/>
+ <xsl:apply-templates mode = "locale"/>
+ </xsl:copy>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:template>
- <xsl:template match="value" mode="locale">
+ <xsl:template match="value" mode="locale">
<xsl:if test="@xml:lang = $locale">
<xsl:copy>
<xsl:apply-templates select = "@*" mode="locale"/>
<xsl:value-of select="."/>
- </xsl:copy>
- </xsl:if>
+ </xsl:copy>
+ </xsl:if>
</xsl:template>
<xsl:template match = "@*" mode="locale">
<xsl:copy/>
- </xsl:template>
+ </xsl:template>
<!-- suppress all merge instructions -->
<xsl:template match = "@oor:op" mode="locale"/>
@@ -131,9 +143,9 @@
<!-- locale independent data -->
<xsl:template match="node" mode="non-locale">
<xsl:param name = "context"/>
- <xsl:param name = "component-schema"/>
+ <xsl:param name = "component-schema"/>
- <xsl:if test="count(descendant::value[not (@xml:lang)]) or count(descendant-or-self::*[@oor:finalized='true'])">
+ <xsl:if test="count(descendant::value[(not (@xml:lang)) or (@xml:lang=$fallback-locale)]) or count(descendant-or-self::*[@oor:finalized='true'])">
<xsl:copy>
<xsl:apply-templates select = "@*" mode="non-locale"/>
<xsl:choose>
@@ -145,7 +157,7 @@
<xsl:with-param name="componentName"><xsl:value-of select="$context/@oor:component"/></xsl:with-param>
</xsl:call-template>
</xsl:variable>
- <xsl:for-each select="node|prop">
+ <xsl:for-each select="node|prop">
<xsl:apply-templates select="." mode="non-locale">
<xsl:with-param name="component-schema" select="$component-schema"/>
<xsl:with-param name="context" select="document($fileURL)/oor:component-schema/templates/*[@oor:name = $context/@oor:node-type]"/>
@@ -154,15 +166,15 @@
</xsl:when>
<!-- look for matching templates within the same component -->
<xsl:when test="$context/@oor:node-type">
- <xsl:for-each select="node|prop">
+ <xsl:for-each select="node|prop">
<xsl:apply-templates select="." mode="non-locale">
<xsl:with-param name="component-schema" select="$component-schema"/>
<xsl:with-param name="context" select="$component-schema/templates/*[@oor:name = $context/@oor:node-type]"/>
</xsl:apply-templates>
</xsl:for-each>
</xsl:when>
- <xsl:otherwise>
- <xsl:for-each select="node|prop">
+ <xsl:otherwise>
+ <xsl:for-each select="node|prop">
<xsl:apply-templates select="." mode="non-locale">
<xsl:with-param name="component-schema" select="$component-schema"/>
<xsl:with-param name="context" select="$context/*[@oor:name = current()/@oor:name]"/>
@@ -171,12 +183,12 @@
</xsl:otherwise>
</xsl:choose>
</xsl:copy>
- </xsl:if>
+ </xsl:if>
</xsl:template>
<xsl:template match="prop" mode="non-locale">
- <xsl:param name = "context"/>
- <xsl:choose>
+ <xsl:param name = "context"/>
+ <xsl:choose>
<xsl:when test="not ($context) or @oor:finalized='true'">
<xsl:copy>
<xsl:apply-templates select = "@*" mode="non-locale"/>
@@ -184,12 +196,12 @@
</xsl:copy>
</xsl:when>
<xsl:when test="count (value[not (@xml:lang)])">
- <!-- copy locale independent values only, if the values differ -->
+ <!-- copy locale independent values only, if the values differ -->
<xsl:variable name="isRedundant">
<xsl:call-template name="isRedundant">
<xsl:with-param name="schemaval" select="$context/value"/>
<xsl:with-param name="dataval" select="value[not (@xml:lang)]"/>
- </xsl:call-template>
+ </xsl:call-template>
</xsl:variable>
<xsl:if test="$isRedundant ='false'">
<xsl:copy>
@@ -198,7 +210,7 @@
</xsl:copy>
</xsl:if>
</xsl:when>
- <xsl:otherwise>
+ <xsl:otherwise>
<xsl:copy>
<xsl:apply-templates select = "@*" mode="non-locale"/>
<xsl:apply-templates select = "value" mode="fallback-locale"/>
@@ -207,30 +219,30 @@
</xsl:choose>
</xsl:template>
- <xsl:template match="value" mode="non-locale">
+ <xsl:template match="value" mode="non-locale">
<xsl:if test="not (@xml:lang)">
<xsl:copy>
<xsl:apply-templates select = "@*" mode="non-locale"/>
<xsl:value-of select="."/>
- </xsl:copy>
+ </xsl:copy>
</xsl:if>
</xsl:template>
- <xsl:template match="value" mode="fallback-locale">
+ <xsl:template match="value" mode="fallback-locale">
<xsl:if test="@xml:lang = $fallback-locale">
<xsl:copy>
<xsl:apply-templates select = "@*" mode="non-locale"/>
<xsl:value-of select="."/>
- </xsl:copy>
+ </xsl:copy>
</xsl:if>
</xsl:template>
<xsl:template match = "@*" mode="non-locale">
<xsl:copy/>
- </xsl:template>
+ </xsl:template>
<!-- compares two values -->
- <xsl:template name="isRedundant">
+ <xsl:template name="isRedundant">
<xsl:param name = "schemaval"/>
<xsl:param name = "dataval"/>
<xsl:choose>
@@ -239,17 +251,7 @@
</xsl:when>
<xsl:when test="not ($schemaval)">
<xsl:choose>
- <xsl:when test="$dataval/@xsi:nil='true'">
- <xsl:value-of select="true()"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="false()"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:when test="$schemaval/@xsi:nil='true'">
- <xsl:choose>
- <xsl:when test="$dataval/@xsi:nil='true'">
+ <xsl:when test="$dataval/@xsi:nil='true'">
<xsl:value-of select="true()"/>
</xsl:when>
<xsl:otherwise>
@@ -270,7 +272,7 @@
<xsl:param name="componentName"/>
<xsl:variable name="fileURL">
<xsl:value-of select="$schemaRootURL"/>/<xsl:value-of select="translate($componentName,'.','/')"/>.xcs
- </xsl:variable>
+ </xsl:variable>
<xsl:value-of select="$fileURL"/>
</xsl:template>
diff --git a/officecfg/util/makefile.pmk b/officecfg/util/makefile.pmk
index 24cf91813526..f4c612e99940 100644
--- a/officecfg/util/makefile.pmk
+++ b/officecfg/util/makefile.pmk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.pmk,v $
#
-# $Revision: 1.22 $
+# $Revision: 1.23 $
#
-# last change: $Author: tpf $ $Date: 2002-12-02 10:44:24 $
+# last change: $Author: hr $ $Date: 2003-03-26 13:50:30 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -75,15 +75,6 @@ $(MISC)$/registry$/schema$/%.xcs : %.xcs
+$(RM) $(@:d)$(<:b).tmp > $(NULLDEV)
+$(RM) $(@:d)$(<:b).val > $(NULLDEV)
-$(MISC)$/xcdformat$/%.xcd : %.xcs
- @+echo -------------+ convert xcs to old format xcd format
- -$(MKDIR) -p $(@:d)
- $(JAVA) -classpath $(SOLARBINDIR)$/xt.jar$(PATH_SEPERATOR)$(SOLARBINDIR)$/parser.jar$(PATH_SEPERATOR)$(CLASSDIR)$/cfgimport.jar -Dcom.jclark.xsl.sax.parser=com.sun.xml.parser.Parser com.jclark.xsl.sax.Driver $< $(PRJ)$/util$/rschema.xsl $(MISC)$/xcdformat$/$(<:d)$(<:b).xcd xcu=$(PRJ)$/registry$/data$/$(<:d)$(<:b).xcu schemaRoot=$(PRJ)$/registry$/schema
-
-$(MISC)$/instance$/%.xml : $(MISC)$/xcdformat$/%.xcd
- @+echo -------------+ create old output format
- $(JAVA) -Xmx128m -classpath $(SOLARBINDIR)$/xt.jar$(PATH_SEPERATOR)$(SOLARBINDIR)$/parser.jar$(PATH_SEPERATOR)$(SOLARBINDIR)$/jaxp.jar$(PATH_SEPERATOR)$(CLASSDIR)$/cfgimport.jar org.openoffice.configuration.XMLDefaultGenerator $< $(PRJ)$/util $(MISC) $(PRJ)$/data
-
$(MISC)$/registry$/res$/{$(alliso)}$/%.properties :| %.xcs
@+echo -------------+ creating locale dependent resource bundles
-$(MKDIR) -p $(@:d)
@@ -101,32 +92,9 @@ $(MISC)$/registry$/data$/%.xcu : %.xcu
+$(RM) $(@:d)$(<:b).tmp > $(NULLDEV)
+$(RM) $(@:d)$(<:b).val > $(NULLDEV)
-$(MISC)$/xcdformat$/%.xcd : %.xcu
- @+echo -------------+ convert xcu to old format xcd format
- -$(MKDIR) -p $(@:d)
- $(JAVA) -classpath $(SOLARBINDIR)$/xt.jar$(PATH_SEPERATOR)$(SOLARBINDIR)$/parser.jar$(PATH_SEPERATOR)$(CLASSDIR)$/cfgimport.jar -Dcom.jclark.xsl.sax.parser=com.sun.xml.parser.Parser com.jclark.xsl.sax.Driver $(PRJ)$/registry$/schema$/$(<:d)$(<:b).xcs $(PRJ)$/util$/rschema.xsl $(MISC)$/xcdformat$/$(<:d)$(<:b).xcd xcu=$(PRJ)$/registry$/data$/$(<:d)$(<:b).xcu schemaRoot=$(PRJ)$/registry$/schema
-
$(MISC)$/registry$/res$/{$(alliso)}$/%.xcu :| %.xcu
@+echo -------------+ creating locale dependent entries
-$(MKDIR) -p $(@:d)
$(JAVA) -classpath $(SOLARBINDIR)$/xt.jar$(PATH_SEPERATOR)$(SOLARBINDIR)$/parser.jar$(PATH_SEPERATOR)$(CLASSDIR)$/cfgimport.jar -Dcom.jclark.xsl.sax.parser=com.sun.xml.parser.Parser com.jclark.xsl.sax.Driver $< $(PRJ)$/util$/alllang.xsl $(@:d)$(<:b).tmp xcs=$(PRJ)$/registry$/schema$/$(<:d)$(<:b).xcs schemaRoot=$(PRJ)$/registry$/schema locale={$(subst,$/$<, $(subst,$(MISC)$/registry$/res$/, $@))}
$(JAVA) -classpath $(SOLARBINDIR)$/jaxp.jar$(PATH_SEPERATOR)$(SOLARBINDIR)$/parser.jar$(PATH_SEPERATOR)$(CLASSDIR)$/schema.jar -Djavax.xml.parsers.SAXParserFactory=com.sun.xml.parser.SAXParserFactoryImpl org.openoffice.helper.PrettyPrinter $(@:d)$(<:b).tmp $(@:d)$(<:b).xcu
+$(RM) $(@:d)$(<:b).tmp > $(NULLDEV)
-
-$(MISC)$/compare$/%.xcd : $(MISC)$/xcdformat$/%.xcd
- @+echo -------------+ comparing generated xcd with original xcd
- -$(MKDIR) -p $(@:d)
- $(JAVA) -Xmx128m -classpath $(SOLARBINDIR)$/xt.jar$(PATH_SEPERATOR)$(SOLARBINDIR)$/parser.jar$(PATH_SEPERATOR)$(CLASSDIR)$/cfgimport.jar -Dcom.jclark.xsl.sax.parser=com.sun.xml.parser.Parser com.jclark.xsl.sax.Driver $< $(PRJ)$/util$/compare.xsl $@ org=$(PRJ)$/data$/{$(subst,$(MISC)$/xcdformat, $(<:d))}$(<:b).xcd
-
-
-# create old output format obsolete
-#$(MISC)$/instance$/%.xml : %.xcd
-# $(JAVA) -Xmx128m -classpath $(SOLARBINDIR)$/xt.jar$(PATH_SEPERATOR)$(SOLARBINDIR)$/parser.jar$(PATH_SEPERATOR)$(SOLARBINDIR)$/jaxp.jar$(PATH_SEPERATOR)$(CLASSDIR)$/cfgimport.jar org.openoffice.configuration.XMLDefaultGenerator $< $(PRJ)$/util $(MISC) $(PRJ)$/data
-
-#$(MISC)$/compare-instance$/%.xml : $(MISC)$/instance$/%.xml
-# -$(MKDIR) -p $(@:d)
-# $(JAVA) -Xmx128m -classpath $(SOLARBINDIR)$/xt.jar$(PATH_SEPERATOR)$(SOLARBINDIR)$/parser.jar$(PATH_SEPERATOR)$(CLASSDIR)$/cfgimport.jar -Dcom.jclark.xsl.sax.parser=com.sun.xml.parser.Parser com.jclark.xsl.sax.Driver $< $(PRJ)$/util$/compare-xml.xsl $@ org=$(PRJ)$/instance$/{$(subst,$(MISC)$/instance, $(<:d))}$(<:b).xml
-
-#$(MISC)$/compare-template$/%.xml : $(MISC)$/template$/%.xml
-# -$(MKDIR) -p $(@:d)
-# $(JAVA) -Xmx128m -classpath $(SOLARBINDIR)$/xt.jar$(PATH_SEPERATOR)$(SOLARBINDIR)$/parser.jar$(PATH_SEPERATOR)$(CLASSDIR)$/cfgimport.jar -Dcom.jclark.xsl.sax.parser=com.sun.xml.parser.Parser com.jclark.xsl.sax.Driver $< $(PRJ)$/util$/compare-xml.xsl $@ org=$(PRJ)$/template$/{$(subst,$(MISC)$/template, $(<:d))}$(<:b).xml
diff --git a/officecfg/util/sanity.xsl b/officecfg/util/sanity.xsl
index 13aa20a9d80d..995f90c9ef82 100644
--- a/officecfg/util/sanity.xsl
+++ b/officecfg/util/sanity.xsl
@@ -18,16 +18,15 @@
<!-- match all elements that could possibly contain info/desc elements -->
<xsl:template match="group|set|node-ref|prop|enumeration|length|minLength|maxLength|minInclusive|maxInclusive|minExclusive|maxExclusive|whiteSpace">
- <xsl:if test="not(info/desc)">
+ <xsl:if test="1>string-length(info/desc)">
<!-- print TPF's path to current node -->
<xsl:message terminate="yes">
<!-- print linefeed -->
<xsl:text>&#10;</xsl:text>
-
- <xsl:text>ERROR: No info/desc element specified</xsl:text>
-
- <!-- print linefeed -->
+ <xsl:text>ERROR: No info/desc element specified or string length of info/desc element is 0.</xsl:text>
+ <xsl:text>&#10;</xsl:text>
+ <xsl:text> There has to be a reasonable description to be specified for any item.</xsl:text>
<xsl:text>&#10;</xsl:text>
<xsl:text> - path: </xsl:text>
@@ -39,10 +38,9 @@
</xsl:choose>
</xsl:for-each>
- <!-- print linefeed -->
<xsl:text>&#10;</xsl:text>
-
<xsl:text> - author: </xsl:text>
+
<xsl:for-each select="ancestor-or-self::*">
<!-- print element name -->
<xsl:if test="info/author">
diff --git a/officecfg/util/schema_val.xsl b/officecfg/util/schema_val.xsl
index 2cf568ef9a09..68aa50fe957d 100644
--- a/officecfg/util/schema_val.xsl
+++ b/officecfg/util/schema_val.xsl
@@ -3,9 +3,9 @@
*
* $RCSfile: schema_val.xsl,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: jb $ $Date: 2002-11-22 11:48:55 $
+ * last change: $Author: hr $ $Date: 2003-03-26 13:50:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -103,9 +103,9 @@
</xsl:if>
</xsl:template>
-<!-- warn for (deprecated) NIL values -->
+<!-- inhibit (explicit) NIL values -->
<xsl:template match="value[@xsi:nil]">
- <xsl:message terminate="no">WARNING: xsi:nil is deprecated in schemas and will be stripped !</xsl:message>
+ <xsl:message terminate="yes">ERROR: xsi:nil is not allowed in schemas !</xsl:message>
</xsl:template>
<!-- validate for correct node references -->