[DEV-3958] c1map: Make output PHP namespace configurable
* src/current/c1map.xsl (lvm:c1map): Copy `@namespace' to generated `lvmp:root'. * src/current/c1map/render.xsl (lvmp:render)[lvmp:root]: Output `@namespace' rather than using hardcoded string and dynamic program.master
parent
cc7e09a700
commit
210693c22f
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
Generates PHP code that works with the LoVullo ConceptOne import system
|
||||
|
||||
Copyright (C) 2016 R-T Specialty, LLC.
|
||||
Copyright (C) 2016, 2018 R-T Specialty, LLC.
|
||||
|
||||
This file is part of TAME.
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
|||
<xsl:stylesheet version="2.0"
|
||||
xmlns:c1="http://www.epic-premier.com/XMLSchema"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:lvm="http://www.lovullo.com/rater/map/c1"
|
||||
xmlns:lvmp="http://www.lovullo.com/rater/map/c1/pp">
|
||||
|
||||
|
@ -68,9 +69,26 @@
|
|||
concat( translate( c1:*[1]/name(), '_', '' ), 'Composer' )
|
||||
" />
|
||||
|
||||
<!-- TODO: this default value maintains BC, but it ought to be specified;
|
||||
remove this in the future -->
|
||||
<xsl:variable name="namespace" as="xs:string"
|
||||
select="if ( @namespace ) then
|
||||
@namespace
|
||||
else
|
||||
concat(
|
||||
'lovullo\c1\interfaces\c1\contract\',
|
||||
@program )" />
|
||||
|
||||
<!-- deprecation warning for above -->
|
||||
<xsl:if test="not( @namespace )">
|
||||
<xsl:message select="concat(
|
||||
'warning: missing lvm:c1-map/@namespace; defaulting to `',
|
||||
replace( $namespace, '\\', '\\\\' ), '''' )" />
|
||||
</xsl:if>
|
||||
|
||||
<!-- preprocessed result -->
|
||||
<xsl:variable name="pp-result">
|
||||
<lvmp:root program="{@program}" name="{$name}">
|
||||
<lvmp:root program="{@program}" name="{$name}" namespace="{$namespace}">
|
||||
<!-- introduce outer scope for variables -->
|
||||
<lvmp:scope id="">
|
||||
<xsl:apply-templates />
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
Renders the final PHP code
|
||||
|
||||
Copyright (C) 2016 R-T Specialty, LLC.
|
||||
Copyright (C) 2016, 2018 R-T Specialty, LLC.
|
||||
|
||||
This file is part of TAME.
|
||||
|
||||
|
@ -45,9 +45,8 @@
|
|||
<xsl:text><?php </xsl:text>
|
||||
<xsl:value-of select="$lvmp:nl" />
|
||||
|
||||
<!-- TODO: add program id to namespace -->
|
||||
<xsl:text>namespace lovullo\c1\interfaces\c1\contract\</xsl:text>
|
||||
<xsl:value-of select="@program" />
|
||||
<xsl:text>namespace </xsl:text>
|
||||
<xsl:value-of select="@namespace" />
|
||||
<xsl:text>;</xsl:text>
|
||||
<xsl:value-of select="$lvmp:nl" />
|
||||
|
||||
|
|
Loading…
Reference in New Issue