diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2017-08-11 09:57:55 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2017-09-20 16:11:23 +0200 |
commit | 28dff3780f9074f585bd626e2f06c94124ef4910 (patch) | |
tree | 9af8f298166c110af5e180170ed3a4ea3ff8d240 /officecfg | |
parent | 732d2e8bb19dbb65f6786e0d109020c189920e1e (diff) |
Clean up xsl files
* Remove trailing spaces
* Use 4 spaces for indentation everywhere
See discussion at https://lists.freedesktop.org/archives/libreoffice/2017-September/078433.html
Change-Id: I0bb9a0b9b0502cdf0870529cea37ee9c4d1ffdf4
Reviewed-on: https://gerrit.libreoffice.org/41009
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'officecfg')
-rw-r--r-- | officecfg/util/alllang.xsl | 314 | ||||
-rw-r--r-- | officecfg/util/data_val.xsl | 286 | ||||
-rw-r--r-- | officecfg/util/resource.xsl | 8 | ||||
-rw-r--r--[-rwxr-xr-x] | officecfg/util/sanity.xsl | 8 | ||||
-rw-r--r-- | officecfg/util/schema_trim.xsl | 84 | ||||
-rw-r--r-- | officecfg/util/schema_val.xsl | 172 |
6 files changed, 436 insertions, 436 deletions
diff --git a/officecfg/util/alllang.xsl b/officecfg/util/alllang.xsl index f5d9ae103fc5..b9b2d1983551 100644 --- a/officecfg/util/alllang.xsl +++ b/officecfg/util/alllang.xsl @@ -17,12 +17,12 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . --> -<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" - 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:install="http://openoffice.org/2004/installation" - exclude-result-prefixes="install"> +<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" + 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:install="http://openoffice.org/2004/installation" + exclude-result-prefixes="install"> <!-- Get the correct format --> <xsl:output method="xml" indent="yes" encoding="UTF-8"/> @@ -46,106 +46,106 @@ <!--************************** TEMPLATES ******************************** --> <!-- ensure that at least root is available --> - <xsl:template match="/oor:component-data"> - <xsl:copy> - <xsl:choose> - <xsl:when test="string-length($locale)"> - <xsl:apply-templates select = "@*" mode="locale"/> - <xsl:apply-templates select = "node|prop" mode="locale"/> - </xsl:when> - <xsl:otherwise> - <xsl:apply-templates select = "@*"/> - <xsl:for-each select="node|prop"> - <xsl:variable name="component-schema" select="document($schemaURL)/oor:component-schema"/> - <xsl:apply-templates select="."> - <xsl:with-param name="component-schema" select="$component-schema"/> - <xsl:with-param name="context" select="$component-schema/component/*[@oor:name = current()/@oor:name]"/> - <xsl:with-param name="find-module" select="$module"/> - </xsl:apply-templates> - </xsl:for-each> - </xsl:otherwise> - </xsl:choose> - </xsl:copy> - </xsl:template> + <xsl:template match="/oor:component-data"> + <xsl:copy> + <xsl:choose> + <xsl:when test="string-length($locale)"> + <xsl:apply-templates select = "@*" mode="locale"/> + <xsl:apply-templates select = "node|prop" mode="locale"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select = "@*"/> + <xsl:for-each select="node|prop"> + <xsl:variable name="component-schema" select="document($schemaURL)/oor:component-schema"/> + <xsl:apply-templates select="."> + <xsl:with-param name="component-schema" select="$component-schema"/> + <xsl:with-param name="context" select="$component-schema/component/*[@oor:name = current()/@oor:name]"/> + <xsl:with-param name="find-module" select="$module"/> + </xsl:apply-templates> + </xsl:for-each> + </xsl:otherwise> + </xsl:choose> + </xsl:copy> + </xsl:template> <!-- locale dependent data --> - <xsl:template match="node|prop" mode = "locale"> + <xsl:template match="node|prop" mode = "locale"> <xsl:choose> <xsl:when test="$locale=$fallback-locale"> <xsl:if test="descendant::value[@xml:lang=$locale]/../value[not (@xml:lang)]"> - <xsl:copy> - <xsl:apply-templates select = "@*" mode="locale"/> - <xsl:apply-templates select = "node|prop|value" mode = "locale"/> - </xsl:copy> + <xsl:copy> + <xsl:apply-templates select = "@*" mode="locale"/> + <xsl:apply-templates select = "node|prop|value" mode = "locale"/> + </xsl:copy> </xsl:if> </xsl:when> <xsl:otherwise> <xsl:if test="descendant::value[@xml:lang = $locale]"> - <xsl:copy> - <xsl:apply-templates select = "@*" mode="locale"/> - <xsl:apply-templates select = "node|prop|value" mode = "locale"/> - </xsl:copy> + <xsl:copy> + <xsl:apply-templates select = "@*" mode="locale"/> + <xsl:apply-templates select = "node|prop|value" mode = "locale"/> + </xsl:copy> </xsl:if> </xsl:otherwise> </xsl:choose> - </xsl:template> + </xsl:template> - <xsl:template match="value" mode="locale"> - <xsl:if test="@xml:lang=$locale and not(@install:module)"> - <xsl:copy> - <xsl:apply-templates select = "@*" mode="locale"/> - <xsl:apply-templates select="node()"/> - </xsl:copy> - </xsl:if> - </xsl:template> + <xsl:template match="value" mode="locale"> + <xsl:if test="@xml:lang=$locale and not(@install:module)"> + <xsl:copy> + <xsl:apply-templates select = "@*" mode="locale"/> + <xsl:apply-templates select="node()"/> + </xsl:copy> + </xsl:if> + </xsl:template> - <xsl:template match = "@*" mode="locale"> - <xsl:copy/> - </xsl:template> + <xsl:template match = "@*" mode="locale"> + <xsl:copy/> + </xsl:template> <!-- suppress all merge instructions --> - <xsl:template match = "@oor:op" mode="locale"/> + <xsl:template match = "@oor:op" mode="locale"/> <!-- suppress all module markers --> - <xsl:template match = "@install:module" mode="locale"/> + <xsl:template match = "@install:module" mode="locale"/> <!-- locale independent data --> <!-- handle template references --> - <xsl:template name="copy-resolve-template"> - <xsl:param name = "node-type"/> - <xsl:param name = "schema-type"/> - <xsl:param name = "component-schema"/> - + <xsl:template name="copy-resolve-template"> + <xsl:param name = "node-type"/> + <xsl:param name = "schema-type"/> + <xsl:param name = "component-schema"/> + <xsl:choose> <xsl:when test="$schema-type='node-ref'"> - <xsl:apply-templates select="."> - <xsl:with-param name="context" select="$component-schema/templates/*[@oor:name = $node-type]"/> - <xsl:with-param name="component-schema" select="$component-schema"/> + <xsl:apply-templates select="."> + <xsl:with-param name="context" select="$component-schema/templates/*[@oor:name = $node-type]"/> + <xsl:with-param name="component-schema" select="$component-schema"/> </xsl:apply-templates> </xsl:when> <xsl:when test="$schema-type='set'"> <xsl:copy> <xsl:apply-templates select = "@*" /> - <xsl:for-each select="node|prop"> - <xsl:apply-templates select="."> - <xsl:with-param name="context" select="$component-schema/templates/*[@oor:name = $node-type]"/> - <xsl:with-param name="component-schema" select="$component-schema"/> + <xsl:for-each select="node|prop"> + <xsl:apply-templates select="."> + <xsl:with-param name="context" select="$component-schema/templates/*[@oor:name = $node-type]"/> + <xsl:with-param name="component-schema" select="$component-schema"/> </xsl:apply-templates> </xsl:for-each> </xsl:copy> </xsl:when> <xsl:otherwise> - <xsl:message terminate="yes">ERROR: The schema element for a <xsl:value-of select="$schema-type"/> + <xsl:message terminate="yes">ERROR: The schema element for a <xsl:value-of select="$schema-type"/> should not have a node-type. </xsl:message> </xsl:otherwise> </xsl:choose> </xsl:template> - - <xsl:template name="copy-node"> - <xsl:param name = "context"/> - <xsl:param name = "component-schema"/> + + <xsl:template name="copy-node"> + <xsl:param name = "context"/> + <xsl:param name = "component-schema"/> <xsl:choose> <!-- look for matching templates in other components --> @@ -182,11 +182,11 @@ </xsl:copy> </xsl:otherwise> </xsl:choose> - </xsl:template> - - <xsl:template match="node"> - <xsl:param name = "context"/> - <xsl:param name = "component-schema"/> + </xsl:template> + + <xsl:template match="node"> + <xsl:param name = "context"/> + <xsl:param name = "component-schema"/> <xsl:variable name="applicable-values" select="descendant::value[not (@xml:lang) or (@xml:lang=$fallback-locale) or (@install:module=$module)]"/> <xsl:variable name="substantive-nodes" select="descendant-or-self::*[(@oor:finalized='true') or (@oor:mandatory='true') or (@oor:op!='modify')]"/> @@ -200,7 +200,7 @@ <xsl:with-param name="context" select="$context"/> </xsl:call-template> </xsl:if> - </xsl:when> + </xsl:when> <!-- strip data from wrong module --> <xsl:when test="ancestor-or-self::*/@install:module"/> <!-- looking for module --> @@ -211,7 +211,7 @@ <xsl:with-param name="context" select="$context"/> </xsl:call-template> </xsl:if> - </xsl:when> + </xsl:when> <!-- copying non-module data --> <xsl:otherwise> <xsl:if test="($applicable-values | $substantive-nodes)[not(ancestor-or-self::*/@install:module)]"> @@ -221,21 +221,21 @@ </xsl:call-template> </xsl:if> </xsl:otherwise> - </xsl:choose> - </xsl:template> + </xsl:choose> + </xsl:template> - <xsl:template match="prop"> - <xsl:param name = "context"/> - <xsl:choose> + <xsl:template match="prop"> + <xsl:param name = "context"/> + <xsl:choose> <xsl:when test="$module and not((ancestor-or-self::* | child::value)/@install:module=$module)"/> <xsl:when test="not($module) and ancestor-or-self::*/@install:module"/> - <xsl:when test="not ($context) or @oor:finalized='true' or @oor:op!='modify'"> - <xsl:copy> - <xsl:apply-templates select = "@*"/> - <xsl:apply-templates select = "value"/> - </xsl:copy> - </xsl:when> - <xsl:when test="value[not (@xml:lang) or @install:module]"> + <xsl:when test="not ($context) or @oor:finalized='true' or @oor:op!='modify'"> + <xsl:copy> + <xsl:apply-templates select = "@*"/> + <xsl:apply-templates select = "value"/> + </xsl:copy> + </xsl:when> + <xsl:when test="value[not (@xml:lang) or @install:module]"> <xsl:if test="value[not(@install:module) or @install:module=$module]"> <!-- copy locale independent values only, if the values differ --> <xsl:variable name="isRedundant"> @@ -250,19 +250,19 @@ <xsl:apply-templates select = "value"/> </xsl:copy> </xsl:if> - </xsl:if> - </xsl:when> - <xsl:otherwise> - <xsl:copy> - <xsl:apply-templates select = "@*"/> - <xsl:apply-templates select = "value" mode="fallback-locale"/> - </xsl:copy> - </xsl:otherwise> - </xsl:choose> - </xsl:template> - - <xsl:template match="value"> - <xsl:choose> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:copy> + <xsl:apply-templates select = "@*"/> + <xsl:apply-templates select = "value" mode="fallback-locale"/> + </xsl:copy> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template match="value"> + <xsl:choose> <xsl:when test="@xml:lang and not(@install:module)"/> <xsl:when test="$module and not(ancestor-or-self::*/@install:module=$module)"/> <xsl:when test="not($module) and ancestor-or-self::*/@install:module"/> @@ -271,16 +271,16 @@ <xsl:apply-templates select = "@*|node()"/> </xsl:copy> </xsl:otherwise> - </xsl:choose> - </xsl:template> + </xsl:choose> + </xsl:template> - <xsl:template match="value" mode="fallback-locale"> - <xsl:if test="@xml:lang=$fallback-locale and not(@install:module)"> + <xsl:template match="value" mode="fallback-locale"> + <xsl:if test="@xml:lang=$fallback-locale and not(@install:module)"> <xsl:copy> <xsl:apply-templates select = "@*|node()"/> </xsl:copy> - </xsl:if> - </xsl:template> + </xsl:if> + </xsl:template> <xsl:template match ="it|unicode"> <xsl:copy> @@ -288,57 +288,57 @@ </xsl:copy> </xsl:template> - <xsl:template match = "@*"> - <xsl:copy/> - </xsl:template> + <xsl:template match = "@*"> + <xsl:copy/> + </xsl:template> <!-- suppress all merge instructions, that are out-of-module --> - <xsl:template match = "@oor:op"> + <xsl:template match = "@oor:op"> <xsl:if test="not($module) or ancestor::*/@install:module"> <xsl:copy/> - </xsl:if> - </xsl:template> + </xsl:if> + </xsl:template> <!-- suppress all module markers --> - <xsl:template match = "@install:module"/> + <xsl:template match = "@install:module"/> <!-- compares two values --> - <xsl:template name="isRedundant"> - <xsl:param name = "schemaval"/> - <xsl:param name = "dataval"/> - <xsl:choose> - <xsl:when test="not ($dataval)"> - <xsl:value-of select="true()"/> - </xsl:when> + <xsl:template name="isRedundant"> + <xsl:param name = "schemaval"/> + <xsl:param name = "dataval"/> + <xsl:choose> + <xsl:when test="not ($dataval)"> + <xsl:value-of select="true()"/> + </xsl:when> <xsl:when test="$dataval/@oor:external"> <xsl:value-of select="false()"/> </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 != $dataval"> - <xsl:value-of select="false()"/> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="true()"/> - </xsl:otherwise> - </xsl:choose> - </xsl:template> - - <xsl:template name="composeFileURL"> - <xsl:param name="componentName"/> - <xsl:variable name="fileURL"> - <xsl:value-of select="$schemaRootURL"/>/<xsl:value-of select="translate($componentName,'.','/')"/><xsl:text>.xcs</xsl:text> - </xsl:variable> - <xsl:value-of select="$fileURL"/> - </xsl:template> + <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 != $dataval"> + <xsl:value-of select="false()"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="true()"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="composeFileURL"> + <xsl:param name="componentName"/> + <xsl:variable name="fileURL"> + <xsl:value-of select="$schemaRootURL"/>/<xsl:value-of select="translate($componentName,'.','/')"/><xsl:text>.xcs</xsl:text> + </xsl:variable> + <xsl:value-of select="$fileURL"/> + </xsl:template> <xsl:template match="@oor:name"> <xsl:attribute name="oor:name"> @@ -391,12 +391,12 @@ <xsl:param name="replace2"/> <xsl:choose> <xsl:when test="contains($input, $pattern1)"> - <xsl:call-template name="replace"> - <xsl:with-param - name="input" select="substring-before($input, $pattern1)"/> - <xsl:with-param name="pattern" select="$pattern2"/> - <xsl:with-param name="replace" select="$replace2"/> - </xsl:call-template> + <xsl:call-template name="replace"> + <xsl:with-param + name="input" select="substring-before($input, $pattern1)"/> + <xsl:with-param name="pattern" select="$pattern2"/> + <xsl:with-param name="replace" select="$replace2"/> + </xsl:call-template> <xsl:value-of select="$replace1"/> <xsl:call-template name="replacetwo"> <xsl:with-param @@ -408,12 +408,12 @@ </xsl:call-template> </xsl:when> <xsl:otherwise> - <xsl:call-template name="replace"> - <xsl:with-param - name="input" select="$input"/> - <xsl:with-param name="pattern" select="$pattern2"/> - <xsl:with-param name="replace" select="$replace2"/> - </xsl:call-template> + <xsl:call-template name="replace"> + <xsl:with-param + name="input" select="$input"/> + <xsl:with-param name="pattern" select="$pattern2"/> + <xsl:with-param name="replace" select="$replace2"/> + </xsl:call-template> </xsl:otherwise> </xsl:choose> </xsl:template> diff --git a/officecfg/util/data_val.xsl b/officecfg/util/data_val.xsl index a6726c1772a2..abe7eb30090c 100644 --- a/officecfg/util/data_val.xsl +++ b/officecfg/util/data_val.xsl @@ -18,13 +18,13 @@ --> <!-- ************************************************************************************** --> -<!-- * Transformation from New Format XCS & XCU to schema description *** --> +<!-- * Transformation from New Format XCS & XCU to schema description *** --> <!-- ************************************************************************************** --> <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" - xmlns:xs="http://www.w3.org/2001/XMLSchema" - xmlns:oor="http://openoffice.org/2001/registry" - xmlns:install="http://openoffice.org/2004/installation"> + xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:oor="http://openoffice.org/2001/registry" + xmlns:install="http://openoffice.org/2004/installation"> <!-- Get the correct format --> <xsl:output method="xml" indent="yes" /> @@ -40,48 +40,48 @@ </xsl:variable> <!-- ************************************** --> -<!-- * oor:component-data *** --> +<!-- * oor:component-data *** --> <!-- ************************************** --> - <xsl:template match="/oor:component-data"> + <xsl:template match="/oor:component-data"> <xsl:variable name="component-schema" select="document($schemaURL)/oor:component-schema"/> - <xsl:for-each select="node|prop"> - <xsl:apply-templates select="."> - <xsl:with-param name="context" select="$component-schema/component/*[@oor:name = current()/@oor:name]"/> - <xsl:with-param name="component-schema" select="$component-schema"/> - </xsl:apply-templates> - </xsl:for-each> - </xsl:template> + <xsl:for-each select="node|prop"> + <xsl:apply-templates select="."> + <xsl:with-param name="context" select="$component-schema/component/*[@oor:name = current()/@oor:name]"/> + <xsl:with-param name="component-schema" select="$component-schema"/> + </xsl:apply-templates> + </xsl:for-each> + </xsl:template> <!-- ****************************************** --> <!-- * handle template references *** --> <!-- ****************************************** --> - <xsl:template name="resolve-template"> - <xsl:param name = "node-type"/> - <xsl:param name = "schema-type"/> - <xsl:param name = "component-schema"/> - <xsl:variable name = "path"> - <xsl:call-template name="collectPath"/> - </xsl:variable> - - <xsl:if test="not ($component-schema)"> - <xsl:message terminate="yes">ERROR: Template '<xsl:value-of select="$node-type"/>', - referenced from node '<xsl:value-of select="$path"/>' + <xsl:template name="resolve-template"> + <xsl:param name = "node-type"/> + <xsl:param name = "schema-type"/> + <xsl:param name = "component-schema"/> + <xsl:variable name = "path"> + <xsl:call-template name="collectPath"/> + </xsl:variable> + + <xsl:if test="not ($component-schema)"> + <xsl:message terminate="yes">ERROR: Template '<xsl:value-of select="$node-type"/>', + referenced from node '<xsl:value-of select="$path"/>' does not exist in schema! </xsl:message> - </xsl:if> + </xsl:if> <xsl:choose> <xsl:when test="$schema-type='node-ref'"> - <xsl:apply-templates select="."> - <xsl:with-param name="context" select="$component-schema/templates/*[@oor:name = $node-type]"/> - <xsl:with-param name="component-schema" select="$component-schema"/> + <xsl:apply-templates select="."> + <xsl:with-param name="context" select="$component-schema/templates/*[@oor:name = $node-type]"/> + <xsl:with-param name="component-schema" select="$component-schema"/> </xsl:apply-templates> </xsl:when> <xsl:when test="$schema-type='set'"> - <xsl:for-each select="node|prop"> - <xsl:apply-templates select="."> - <xsl:with-param name="context" select="$component-schema/templates/*[@oor:name = $node-type]"/> - <xsl:with-param name="component-schema" select="$component-schema"/> + <xsl:for-each select="node|prop"> + <xsl:apply-templates select="."> + <xsl:with-param name="context" select="$component-schema/templates/*[@oor:name = $node-type]"/> + <xsl:with-param name="component-schema" select="$component-schema"/> </xsl:apply-templates> </xsl:for-each> </xsl:when> @@ -92,95 +92,95 @@ </xsl:otherwise> </xsl:choose> </xsl:template> - + <!-- ****************************************** --> -<!-- * node *** --> +<!-- * node *** --> <!-- ****************************************** --> - <xsl:template match="node"> - <xsl:param name = "context"/> - <xsl:param name = "component-schema"/> - <xsl:variable name = "path"> - <xsl:call-template name="collectPath"/> - </xsl:variable> - - <xsl:if test="not ($context)"> - <xsl:message terminate="yes">ERROR: Node '<xsl:value-of select="$path"/>' does not exist in schema!</xsl:message> - </xsl:if> + <xsl:template match="node"> + <xsl:param name = "context"/> + <xsl:param name = "component-schema"/> + <xsl:variable name = "path"> + <xsl:call-template name="collectPath"/> + </xsl:variable> + + <xsl:if test="not ($context)"> + <xsl:message terminate="yes">ERROR: Node '<xsl:value-of select="$path"/>' does not exist in schema!</xsl:message> + </xsl:if> <xsl:call-template name="checkModule"/> <xsl:call-template name="checkDuplicates"/> - <xsl:choose> - <!-- look for matching templates in other components --> - <xsl:when test="$context/@oor:node-type and $context/@oor:component"> - <xsl:variable name="fileURL"> - <xsl:call-template name="composeFileURL"> - <xsl:with-param name="componentName"><xsl:value-of select="$context/@oor:component"/></xsl:with-param> - </xsl:call-template> - </xsl:variable> + <xsl:choose> + <!-- look for matching templates in other components --> + <xsl:when test="$context/@oor:node-type and $context/@oor:component"> + <xsl:variable name="fileURL"> + <xsl:call-template name="composeFileURL"> + <xsl:with-param name="componentName"><xsl:value-of select="$context/@oor:component"/></xsl:with-param> + </xsl:call-template> + </xsl:variable> <xsl:call-template name="resolve-template"> <xsl:with-param name="node-type" select="$context/@oor:node-type"/> <xsl:with-param name="schema-type" select="local-name($context)"/> <xsl:with-param name="component-schema" select="document($fileURL)/oor:component-schema"/> </xsl:call-template> - </xsl:when> - <!-- look for matching templates within the same component --> - <xsl:when test="$context/@oor:node-type"> + </xsl:when> + <!-- look for matching templates within the same component --> + <xsl:when test="$context/@oor:node-type"> <xsl:call-template name="resolve-template"> <xsl:with-param name="node-type" select="$context/@oor:node-type"/> <xsl:with-param name="schema-type" select="local-name($context)"/> <xsl:with-param name="component-schema" select="$component-schema"/> </xsl:call-template> - </xsl:when> - <!-- is the node extensible ? --> - <xsl:when test="$context/@oor:extensible='true'"> - <xsl:for-each select="node|prop"> - <xsl:apply-templates select="." mode="extensible"> - <xsl:with-param name="context" select="$context/*[@oor:name = current()/@oor:name]"/> - <xsl:with-param name="component-schema" select="$component-schema"/> - </xsl:apply-templates> - </xsl:for-each> - </xsl:when> - <xsl:otherwise> - <xsl:for-each select="node|prop"> - <xsl:apply-templates select="."> - <xsl:with-param name="context" select="$context/*[@oor:name = current()/@oor:name]"/> - <xsl:with-param name="component-schema" select="$component-schema"/> - </xsl:apply-templates> - </xsl:for-each> - </xsl:otherwise> - </xsl:choose> - </xsl:template> + </xsl:when> + <!-- is the node extensible ? --> + <xsl:when test="$context/@oor:extensible='true'"> + <xsl:for-each select="node|prop"> + <xsl:apply-templates select="." mode="extensible"> + <xsl:with-param name="context" select="$context/*[@oor:name = current()/@oor:name]"/> + <xsl:with-param name="component-schema" select="$component-schema"/> + </xsl:apply-templates> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <xsl:for-each select="node|prop"> + <xsl:apply-templates select="."> + <xsl:with-param name="context" select="$context/*[@oor:name = current()/@oor:name]"/> + <xsl:with-param name="component-schema" select="$component-schema"/> + </xsl:apply-templates> + </xsl:for-each> + </xsl:otherwise> + </xsl:choose> + </xsl:template> <!-- ****************************************** --> -<!-- * prop *** --> +<!-- * prop *** --> <!-- ****************************************** --> - <xsl:template match="prop"> - <xsl:param name = "context"/> - <xsl:variable name = "path"> - <xsl:call-template name="collectPath"/> - </xsl:variable> - + <xsl:template match="prop"> + <xsl:param name = "context"/> + <xsl:variable name = "path"> + <xsl:call-template name="collectPath"/> + </xsl:variable> + - <xsl:if test="not ($context)"> - <xsl:message terminate="yes">ERROR: Property '<xsl:value-of select="$path"/>' does not exist in schema !</xsl:message> - </xsl:if> + <xsl:if test="not ($context)"> + <xsl:message terminate="yes">ERROR: Property '<xsl:value-of select="$path"/>' does not exist in schema !</xsl:message> + </xsl:if> - <xsl:if test="@oor:op"> - <xsl:message terminate="yes">ERROR: Property '<xsl:value-of select="$path"/>' has unexpected operation '<xsl:value-of select="@oor:op"/>' !</xsl:message> - </xsl:if> + <xsl:if test="@oor:op"> + <xsl:message terminate="yes">ERROR: Property '<xsl:value-of select="$path"/>' has unexpected operation '<xsl:value-of select="@oor:op"/>' !</xsl:message> + </xsl:if> <xsl:call-template name="checkModule"/> <xsl:call-template name="checkDuplicates"/> - - <xsl:apply-templates /> - </xsl:template> + + <xsl:apply-templates /> + </xsl:template> <!-- ****************************************** --> -<!-- * value *** --> +<!-- * value *** --> <!-- ****************************************** --> - <xsl:template match="value"> + <xsl:template match="value"> <xsl:call-template name="checkModule"/> <xsl:variable name="path"> <xsl:call-template name="collectPath"/> @@ -200,94 +200,94 @@ <xsl:message terminate="yes">ERROR: Property '<xsl:value-of select="$path"/>' has values with matching xml:lang attribute <xsl:value-of select="$lang"/> and inconsistent install:module attributes.</xsl:message> </xsl:when> </xsl:choose> - </xsl:template> + </xsl:template> <!-- ****************************************** --> <!-- * node (mode:extensible) - not supported * --> <!-- ****************************************** --> - <xsl:template match="node" mode="extensible"> - <xsl:variable name = "path"> - <xsl:call-template name="collectPath"/> - </xsl:variable> + <xsl:template match="node" mode="extensible"> + <xsl:variable name = "path"> + <xsl:call-template name="collectPath"/> + </xsl:variable> <xsl:message terminate="yes">ERROR: Node '<xsl:value-of select="$path"/>' is within an extensible node!</xsl:message> </xsl:template> <!-- ****************************************** --> -<!-- * prop (mode:extensible) *** --> +<!-- * prop (mode:extensible) *** --> <!-- ****************************************** --> - <xsl:template match="prop" mode="extensible"> - <xsl:param name = "context"/> - <xsl:variable name = "path"> - <xsl:call-template name="collectPath"/> - </xsl:variable> + <xsl:template match="prop" mode="extensible"> + <xsl:param name = "context"/> + <xsl:variable name = "path"> + <xsl:call-template name="collectPath"/> + </xsl:variable> <xsl:choose> <xsl:when test="not(@oor:op)"> - <xsl:if test="not ($context)"> - <xsl:message terminate="yes">ERROR: Property '<xsl:value-of select="$path"/>' does not exist in schema!</xsl:message> - </xsl:if> - </xsl:when> + <xsl:if test="not ($context)"> + <xsl:message terminate="yes">ERROR: Property '<xsl:value-of select="$path"/>' does not exist in schema!</xsl:message> + </xsl:if> + </xsl:when> <xsl:when test="@oor:op='replace'"> - <xsl:if test="not (@oor:type)"> - <xsl:message terminate="yes">ERROR: Property '<xsl:value-of select="$path"/>' does not have a type!</xsl:message> - </xsl:if> - </xsl:when> - <xsl:otherwise> - <xsl:message terminate="yes">ERROR: Property '<xsl:value-of select="$path"/>' has unexpected operation '<xsl:value-of select="@oor:op"/>'!</xsl:message> - </xsl:otherwise> + <xsl:if test="not (@oor:type)"> + <xsl:message terminate="yes">ERROR: Property '<xsl:value-of select="$path"/>' does not have a type!</xsl:message> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:message terminate="yes">ERROR: Property '<xsl:value-of select="$path"/>' has unexpected operation '<xsl:value-of select="@oor:op"/>'!</xsl:message> + </xsl:otherwise> </xsl:choose> <xsl:call-template name="checkModule"/> <xsl:call-template name="checkDuplicates"/> - </xsl:template> + </xsl:template> <!-- ************************************* --> -<!-- * checkDuplicates *** --> +<!-- * checkDuplicates *** --> <!-- ************************************* --> - <xsl:template name="checkDuplicates"> + <xsl:template name="checkDuplicates"> <xsl:variable name="item-name" select="@oor:name"/> - <xsl:if test="following-sibling::*[@oor:name = $item-name]"> + <xsl:if test="following-sibling::*[@oor:name = $item-name]"> <xsl:variable name = "path"> <xsl:call-template name="collectPath"/> </xsl:variable> - <xsl:message terminate="yes">ERROR: Duplicate node/prop '<xsl:value-of select="$path"/>'!</xsl:message> - </xsl:if> - </xsl:template> + <xsl:message terminate="yes">ERROR: Duplicate node/prop '<xsl:value-of select="$path"/>'!</xsl:message> + </xsl:if> + </xsl:template> <!-- ************************************* --> -<!-- * checkModule *** --> +<!-- * checkModule *** --> <!-- ************************************* --> - <xsl:template name="checkModule"> - <xsl:if test="@install:module"> + <xsl:template name="checkModule"> + <xsl:if test="@install:module"> <xsl:if test="ancestor::*[@install:module]"> <xsl:message terminate="yes">ERROR: Nested modules are not supported. Found module '<xsl:value-of select="@install:module"/>' within module '<xsl:value-of select="ancestor::*/@install:module"/>'! </xsl:message> - </xsl:if> - </xsl:if> - </xsl:template> + </xsl:if> + </xsl:if> + </xsl:template> <!-- ************************************* --> -<!-- * collectPath *** --> +<!-- * collectPath *** --> <!-- ************************************* --> - <xsl:template name="collectPath"> - <xsl:for-each select="ancestor-or-self::node()[@oor:name]"> - <xsl:text>/</xsl:text><xsl:value-of select="@oor:name"/> - </xsl:for-each> - </xsl:template> + <xsl:template name="collectPath"> + <xsl:for-each select="ancestor-or-self::node()[@oor:name]"> + <xsl:text>/</xsl:text><xsl:value-of select="@oor:name"/> + </xsl:for-each> + </xsl:template> <!-- ****************************** --> -<!-- * composeFileURL *** --> +<!-- * composeFileURL *** --> <!-- ****************************** --> - <xsl:template name="composeFileURL"> - <xsl:param name="componentName"/> - <xsl:variable name="fileURL"> - <xsl:value-of select="$schemaRootURL"/>/<xsl:value-of select="translate($componentName,'.','/')"/><xsl:text>.xcs</xsl:text> - </xsl:variable> - <xsl:value-of select="$fileURL"/> - </xsl:template> + <xsl:template name="composeFileURL"> + <xsl:param name="componentName"/> + <xsl:variable name="fileURL"> + <xsl:value-of select="$schemaRootURL"/>/<xsl:value-of select="translate($componentName,'.','/')"/><xsl:text>.xcs</xsl:text> + </xsl:variable> + <xsl:value-of select="$fileURL"/> + </xsl:template> </xsl:transform> diff --git a/officecfg/util/resource.xsl b/officecfg/util/resource.xsl index d3b44ae679d3..a0119b146cf7 100644 --- a/officecfg/util/resource.xsl +++ b/officecfg/util/resource.xsl @@ -18,10 +18,10 @@ --> <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" - version="1.0"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:oor="http://openoffice.org/2001/registry" + version="1.0"> <!-- Set correct output format --> <xsl:output method="text" indent="no" encoding="UTF-8"/> diff --git a/officecfg/util/sanity.xsl b/officecfg/util/sanity.xsl index ea923ed8af86..a02ba25c2972 100755..100644 --- a/officecfg/util/sanity.xsl +++ b/officecfg/util/sanity.xsl @@ -17,10 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . --> <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" - version="1.0"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:oor="http://openoffice.org/2001/registry" + version="1.0"> <xsl:output method="text" indent="no" encoding="ISO-8859-1"/> diff --git a/officecfg/util/schema_trim.xsl b/officecfg/util/schema_trim.xsl index 4ebac1c5b733..f67d89194a51 100644 --- a/officecfg/util/schema_trim.xsl +++ b/officecfg/util/schema_trim.xsl @@ -18,62 +18,62 @@ --> <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" - version="1.0"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:oor="http://openoffice.org/2001/registry" + version="1.0"> <xsl:param name="LIBO_SHARE_FOLDER"/> <xsl:param name="LIBO_SHARE_HELP_FOLDER"/> <!-- Get the correct format --> - <xsl:output method="xml" indent="yes"/> - <xsl:namespace-alias stylesheet-prefix="xs" result-prefix="xs"></xsl:namespace-alias> + <xsl:output method="xml" indent="yes"/> + <xsl:namespace-alias stylesheet-prefix="xs" result-prefix="xs"></xsl:namespace-alias> <!-- Remove all comments from the schema files --> - <xsl:template match="*|@*"> - <xsl:copy> - <xsl:apply-templates select="*|@*"/> - </xsl:copy> - </xsl:template> + <xsl:template match="*|@*"> + <xsl:copy> + <xsl:apply-templates select="*|@*"/> + </xsl:copy> + </xsl:template> <!-- suppress the location of the schema --> - <xsl:template match = "@xsi:schemaLocation"/> + <xsl:template match = "@xsi:schemaLocation"/> <!-- suppress the constraints of the schema - <xsl:template match = "constraints"/> --> + <xsl:template match = "constraints"/> --> <!-- suppress all documentation items - <xsl:template match = "info"/> --> + <xsl:template match = "info"/> --> <!-- suppress constraints for deprecated items --> - <xsl:template match = "constraints[../info/deprecated]"/> + <xsl:template match = "constraints[../info/deprecated]"/> <!-- suppress all documentation for deprecated items --> - <xsl:template match = "desc[../deprecated]"/> - <xsl:template match = "label[../deprecated]"/> + <xsl:template match = "desc[../deprecated]"/> + <xsl:template match = "label[../deprecated]"/> <!-- copy all other documentation with content --> - <xsl:template match="desc|label"> - <xsl:copy> - <xsl:apply-templates select="@*"/> - <xsl:value-of select="."/> - </xsl:copy> - </xsl:template> + <xsl:template match="desc|label"> + <xsl:copy> + <xsl:apply-templates select="@*"/> + <xsl:value-of select="."/> + </xsl:copy> + </xsl:template> <!-- suppress all author items --> - <xsl:template match = "author"/> + <xsl:template match = "author"/> <!-- suppress values, which are marked as nil --> - <xsl:template match="value[@xsi:nil='true']" /> + <xsl:template match="value[@xsi:nil='true']" /> <!-- copy all other values with content --> - <xsl:template match="value"> - <xsl:copy> - <xsl:apply-templates select="@*|node()"/> - </xsl:copy> - </xsl:template> + <xsl:template match="value"> + <xsl:copy> + <xsl:apply-templates select="@*|node()"/> + </xsl:copy> + </xsl:template> <xsl:template match ="it|unicode"> <xsl:copy> @@ -120,12 +120,12 @@ <xsl:param name="replace2"/> <xsl:choose> <xsl:when test="contains($input, $pattern1)"> - <xsl:call-template name="replace"> - <xsl:with-param - name="input" select="substring-before($input, $pattern1)"/> - <xsl:with-param name="pattern" select="$pattern2"/> - <xsl:with-param name="replace" select="$replace2"/> - </xsl:call-template> + <xsl:call-template name="replace"> + <xsl:with-param + name="input" select="substring-before($input, $pattern1)"/> + <xsl:with-param name="pattern" select="$pattern2"/> + <xsl:with-param name="replace" select="$replace2"/> + </xsl:call-template> <xsl:value-of select="$replace1"/> <xsl:call-template name="replacetwo"> <xsl:with-param @@ -137,12 +137,12 @@ </xsl:call-template> </xsl:when> <xsl:otherwise> - <xsl:call-template name="replace"> - <xsl:with-param - name="input" select="$input"/> - <xsl:with-param name="pattern" select="$pattern2"/> - <xsl:with-param name="replace" select="$replace2"/> - </xsl:call-template> + <xsl:call-template name="replace"> + <xsl:with-param + name="input" select="$input"/> + <xsl:with-param name="pattern" select="$pattern2"/> + <xsl:with-param name="replace" select="$replace2"/> + </xsl:call-template> </xsl:otherwise> </xsl:choose> </xsl:template> diff --git a/officecfg/util/schema_val.xsl b/officecfg/util/schema_val.xsl index 4161808af2d2..38478ea8bb50 100644 --- a/officecfg/util/schema_val.xsl +++ b/officecfg/util/schema_val.xsl @@ -18,10 +18,10 @@ --> <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" - version="1.0"> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:oor="http://openoffice.org/2001/registry" + version="1.0"> <!-- Get the correct format --> <xsl:output method="xml" indent="yes"/> @@ -32,108 +32,108 @@ <xsl:param name="schemaRoot"/> <xsl:param name="componentName"/> - <xsl:template match = "/"> - <xsl:apply-templates/> - </xsl:template> - + <xsl:template match = "/"> + <xsl:apply-templates/> + </xsl:template> + <!-- activate attribute templates --> - <xsl:template match="group|set|prop"> - <xsl:apply-templates select="*|@*"/> - </xsl:template> + <xsl:template match="group|set|prop"> + <xsl:apply-templates select="*|@*"/> + </xsl:template> <!-- make sure that missing features are not invoked --> - <xsl:template match = "item"> - <xsl:message terminate="yes">ERROR: multiple template types for sets are NOT supported!</xsl:message> - </xsl:template> + <xsl:template match = "item"> + <xsl:message terminate="yes">ERROR: multiple template types for sets are NOT supported!</xsl:message> + </xsl:template> - <xsl:template match = "set[@oor:extensible='true']"> - <xsl:message terminate="yes">ERROR: extensible sets are currently NOT supported!</xsl:message> - </xsl:template> + <xsl:template match = "set[@oor:extensible='true']"> + <xsl:message terminate="yes">ERROR: extensible sets are currently NOT supported!</xsl:message> + </xsl:template> - <xsl:template match = "group[@oor:extensible='true']"> - <xsl:if test="count(child::set) or count(child::group) or count(child::node-ref)"> - <xsl:message terminate="yes">ERROR: extensible groups with children are currently NOT supported!</xsl:message> - </xsl:if> - <xsl:apply-templates select="*|@*"/> - </xsl:template> + <xsl:template match = "group[@oor:extensible='true']"> + <xsl:if test="count(child::set) or count(child::group) or count(child::node-ref)"> + <xsl:message terminate="yes">ERROR: extensible groups with children are currently NOT supported!</xsl:message> + </xsl:if> + <xsl:apply-templates select="*|@*"/> + </xsl:template> <!-- Localized info elements (desc/label) are not supported currently --> - <xsl:template match="info//*[@xml:lang]"> - <xsl:message terminate="yes">ERROR: Info elements (desc/label) are currently not localized. Remove xml:lang attributes!</xsl:message> - </xsl:template> + <xsl:template match="info//*[@xml:lang]"> + <xsl:message terminate="yes">ERROR: Info elements (desc/label) are currently not localized. Remove xml:lang attributes!</xsl:message> + </xsl:template> <!-- check for duplicate child names --> - <xsl:template match="@oor:name"> + <xsl:template match="@oor:name"> <xsl:variable name="item-name" select="."/> - <xsl:if test="../following-sibling::*[@oor:name = $item-name]"> - <xsl:message terminate="yes">ERROR: Duplicate node name '<xsl:value-of select="$item-name"/>'!</xsl:message> - </xsl:if> - </xsl:template> + <xsl:if test="../following-sibling::*[@oor:name = $item-name]"> + <xsl:message terminate="yes">ERROR: Duplicate node name '<xsl:value-of select="$item-name"/>'!</xsl:message> + </xsl:if> + </xsl:template> <!-- check if properties of type 'any' do not have a value --> - <xsl:template match="prop[@oor:type='oor:any']"> - <xsl:if test="count(value)"> - <xsl:message terminate="yes">ERROR: Properties of type 'oor:any' MUST NOT have a value!</xsl:message> - </xsl:if> - <xsl:apply-templates select="*|@*"/> - </xsl:template> + <xsl:template match="prop[@oor:type='oor:any']"> + <xsl:if test="count(value)"> + <xsl:message terminate="yes">ERROR: Properties of type 'oor:any' MUST NOT have a value!</xsl:message> + </xsl:if> + <xsl:apply-templates select="*|@*"/> + </xsl:template> <!-- inhibit (explicit) NIL values --> - <xsl:template match="value[@xsi:nil]"> - <xsl:message terminate="yes">ERROR: xsi:nil is not allowed in schemas !</xsl:message> - </xsl:template> + <xsl:template match="value[@xsi:nil]"> + <xsl:message terminate="yes">ERROR: xsi:nil is not allowed in schemas !</xsl:message> + </xsl:template> <!-- validate for correct node references --> - <xsl:template match="@oor:node-type"> - <xsl:choose> - <xsl:when test="../@oor:component"> - <xsl:variable name ="file"> - <xsl:call-template name="locateFile"><xsl:with-param name="componentName" select="../@oor:component"/></xsl:call-template> - </xsl:variable> - <xsl:if test="not(document($file)/oor:component-schema/templates/*[@oor:name=current()])"> - <xsl:message terminate="yes">ERROR: node-type '<xsl:value-of select="current()"/>' not found!</xsl:message> - </xsl:if> - </xsl:when> - <xsl:when test="not(/oor:component-schema/templates/*[@oor:name=current()])"> - <xsl:message terminate="yes">ERROR: node-type '<xsl:value-of select="current()"/>' not found!</xsl:message> - </xsl:when> - </xsl:choose> - </xsl:template> + <xsl:template match="@oor:node-type"> + <xsl:choose> + <xsl:when test="../@oor:component"> + <xsl:variable name ="file"> + <xsl:call-template name="locateFile"><xsl:with-param name="componentName" select="../@oor:component"/></xsl:call-template> + </xsl:variable> + <xsl:if test="not(document($file)/oor:component-schema/templates/*[@oor:name=current()])"> + <xsl:message terminate="yes">ERROR: node-type '<xsl:value-of select="current()"/>' not found!</xsl:message> + </xsl:if> + </xsl:when> + <xsl:when test="not(/oor:component-schema/templates/*[@oor:name=current()])"> + <xsl:message terminate="yes">ERROR: node-type '<xsl:value-of select="current()"/>' not found!</xsl:message> + </xsl:when> + </xsl:choose> + </xsl:template> <!-- validate if file name matches component-name --> - <xsl:template match="oor:component-schema"> - <xsl:variable name ="fullName"><xsl:value-of select="@oor:package"/>.<xsl:value-of select="@oor:name"/></xsl:variable> - <xsl:if test="$fullName != $componentName"> - <xsl:message terminate="yes">ERROR: Component name '<xsl:value-of select="$fullName"/>' does not match with file name!</xsl:message> - </xsl:if> - <xsl:apply-templates select="*|@*"/> - </xsl:template> + <xsl:template match="oor:component-schema"> + <xsl:variable name ="fullName"><xsl:value-of select="@oor:package"/>.<xsl:value-of select="@oor:name"/></xsl:variable> + <xsl:if test="$fullName != $componentName"> + <xsl:message terminate="yes">ERROR: Component name '<xsl:value-of select="$fullName"/>' does not match with file name!</xsl:message> + </xsl:if> + <xsl:apply-templates select="*|@*"/> + </xsl:template> <!-- locate a component file --> - <xsl:template name="locateFile"> - <xsl:param name="componentName"/> - <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> + <xsl:template name="locateFile"> + <xsl:param name="componentName"/> + <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> </xsl:transform> |