allow to set extra (global) schema root
This commit is contained in:
@@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
<!-- Parameter -->
|
<!-- Parameter -->
|
||||||
<xsl:param name="root">../registry/schema</xsl:param>
|
<xsl:param name="root">../registry/schema</xsl:param>
|
||||||
|
<xsl:param name="schemaRoot"/>
|
||||||
<xsl:param name="componentName"/>
|
<xsl:param name="componentName"/>
|
||||||
|
|
||||||
<xsl:template match = "/">
|
<xsl:template match = "/">
|
||||||
@@ -121,9 +122,25 @@
|
|||||||
<!-- locate a component file -->
|
<!-- locate a component file -->
|
||||||
<xsl:template name="locateFile">
|
<xsl:template name="locateFile">
|
||||||
<xsl:param name="componentName"/>
|
<xsl:param name="componentName"/>
|
||||||
<xsl:variable name ="file"><xsl:value-of select="$root"/>/<xsl:value-of select="translate($componentName,'.','/')"/>.xcs</xsl:variable>
|
<xsl:variable name="path"><xsl:value-of select="translate($componentName,'.','/')"/>.xcs</xsl:variable>
|
||||||
<xsl:if test="not( document($file) )">
|
<xsl:variable name ="file">
|
||||||
<xsl:message terminate ="yes">**Error: unable to locate document '<xsl:value-of select="translate($componentName,'.','/')"/>.xcd'</xsl:message>
|
<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:if>
|
||||||
<xsl:value-of select="$file"/>
|
<xsl:value-of select="$file"/>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
@@ -78,6 +78,7 @@ $(call gb_Helper_abbreviate_dirs,\
|
|||||||
--noout \
|
--noout \
|
||||||
--stringparam componentName $(subst /,.,$(basename $(XCSFILE))) \
|
--stringparam componentName $(subst /,.,$(basename $(XCSFILE))) \
|
||||||
--stringparam root $(subst $(XCSFILE),,$(3)) \
|
--stringparam root $(subst $(XCSFILE),,$(3)) \
|
||||||
|
$(if $(SCHEMA_ROOT),--stringparam schemaRoot $(SCHEMA_ROOT)) \
|
||||||
$(gb_XcsTarget_XSLT_SchemaVal) \
|
$(gb_XcsTarget_XSLT_SchemaVal) \
|
||||||
$(3) && \
|
$(3) && \
|
||||||
$(gb_XSLTPROC) --nonet \
|
$(gb_XSLTPROC) --nonet \
|
||||||
@@ -348,6 +349,9 @@ $(foreach lang,$(gb_Configuration_LANGS),$(eval \
|
|||||||
$(foreach lang,$(gb_Configuration_LANGS),$(eval \
|
$(foreach lang,$(gb_Configuration_LANGS),$(eval \
|
||||||
$(call gb_Configuration_get_clean_target,$(1)) : \
|
$(call gb_Configuration_get_clean_target,$(1)) : \
|
||||||
$(call gb_Zip_get_clean_target,$(1)_$(lang))))
|
$(call gb_Zip_get_clean_target,$(1)_$(lang))))
|
||||||
|
|
||||||
|
$(call gb_Configuration_get_target,$(1)) : SCHEMA_ROOT :=
|
||||||
|
|
||||||
$$(eval $$(call gb_Module_register_target,$(call gb_Configuration_get_target,$(1)),$(call gb_Configuration_get_clean_target,$(1))))
|
$$(eval $$(call gb_Module_register_target,$(call gb_Configuration_get_target,$(1)),$(call gb_Configuration_get_clean_target,$(1))))
|
||||||
|
|
||||||
endef
|
endef
|
||||||
@@ -493,4 +497,15 @@ $(foreach xcu,$(3),$(call gb_Configuration_add_localized_data,$(1),$(2),$(xcu)))
|
|||||||
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
# Set extra registry this configuration can use schemas from.
|
||||||
|
#
|
||||||
|
# Example:
|
||||||
|
# # foo needs schemas from the main configuration
|
||||||
|
# $(eval $(call gb_Configuration_use_configuration,foo,officecfg))
|
||||||
|
define gb_Configuration_use_configuration
|
||||||
|
$(call gb_Configuration_get_target,$(1)) : $(call gb_Configuration_get_target,$(2))
|
||||||
|
$(call gb_Configuration_get_target,$(1)) : SCHEMA_ROOT := $(gb_Configuration_registry)/schema
|
||||||
|
|
||||||
|
endef
|
||||||
|
|
||||||
# vim: set noet sw=4 ts=4:
|
# vim: set noet sw=4 ts=4:
|
||||||
|
Reference in New Issue
Block a user