summaryrefslogtreecommitdiff
path: root/officecfg/util/schema_val.xsl
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2012-04-07 12:08:19 +0200
committerDavid Tardon <dtardon@redhat.com>2012-05-29 07:24:55 +0200
commitc199ce6d62c91d72eb7a038efea504b6de644406 (patch)
tree8507239beed26c2e60dea18a1ee30795d03bc10e /officecfg/util/schema_val.xsl
parent9b530e1a1eab7f33873952512d73aea02ac6b275 (diff)
allow to set extra (global) schema root
Diffstat (limited to 'officecfg/util/schema_val.xsl')
-rwxr-xr-xofficecfg/util/schema_val.xsl23
1 files changed, 20 insertions, 3 deletions
diff --git a/officecfg/util/schema_val.xsl b/officecfg/util/schema_val.xsl
index 04342e7299a5..1ae2ff7abc64 100755
--- a/officecfg/util/schema_val.xsl
+++ b/officecfg/util/schema_val.xsl
@@ -38,6 +38,7 @@
<!-- Parameter -->
<xsl:param name="root">../registry/schema</xsl:param>
+<xsl:param name="schemaRoot"/>
<xsl:param name="componentName"/>
<xsl:template match = "/">
@@ -121,9 +122,25 @@
<!-- locate a component file -->
<xsl:template name="locateFile">
<xsl:param name="componentName"/>
- <xsl:variable name ="file"><xsl:value-of select="$root"/>/<xsl:value-of select="translate($componentName,'.','/')"/>.xcs</xsl:variable>
- <xsl:if test="not( document($file) )">
- <xsl:message terminate ="yes">**Error: unable to locate document '<xsl:value-of select="translate($componentName,'.','/')"/>.xcd'</xsl:message>
+ <xsl:variable name="path"><xsl:value-of select="translate($componentName,'.','/')"/>.xcs</xsl:variable>
+ <xsl:variable name ="file">
+ <xsl:variable name ="tryfile" select="concat($root,'/',$path)"/>
+ <xsl:choose>
+ <xsl:when test="document($tryfile)">
+ <xsl:value-of select="$tryfile"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="$schemaRoot">
+ <xsl:variable name="globalfile" select="concat($schemaRoot,'/',$path)"/>
+ <xsl:if test="document($globalfile)">
+ <xsl:value-of select="$globalfile"/>
+ </xsl:if>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="not($file)">
+ <xsl:message terminate ="yes">**Error: unable to locate document '<xsl:value-of select="$path"/>'</xsl:message>
</xsl:if>
<xsl:value-of select="$file"/>
</xsl:template>