P
Petterson Mikael
Hi,
I am generating code using xsl. I have two templates for that. One for
the name and one for the value ( these are pairs). I have checked that
maxCount is the same for both ( e.g. 4) but I get something like:
from template for names:
<sequencename>_name0
<sequencename>_name1
<sequencename>_name2
<sequencename>_name3
from template for values:
<sequencename>_value[0]
<sequencename>_value[1]
<sequencename>_value[2]
<sequencename>_value[3]
<sequencename>_value[4]
Anyone that can see why?
cheers,
//mikael
Template for names:
===================
Template for value:
===================
I am generating code using xsl. I have two templates for that. One for
the name and one for the value ( these are pairs). I have checked that
maxCount is the same for both ( e.g. 4) but I get something like:
from template for names:
<sequencename>_name0
<sequencename>_name1
<sequencename>_name2
<sequencename>_name3
from template for values:
<sequencename>_value[0]
<sequencename>_value[1]
<sequencename>_value[2]
<sequencename>_value[3]
<sequencename>_value[4]
Anyone that can see why?
cheers,
//mikael
Template for names:
===================
<!-- Template that create "<sequencename>_name0", "<sequencename>_name1"..:
super(new String[] {
"scramblingCode", "noOfEAgchCodes", "eAgchCodes_name_0",
"eAgchCodes_name_1", "eAgchCodes_name_2",
"eAgchCodes_name_3", "noOfEHichERgchCodes",
"eHichERgchCodes_name_0", "eHichERgchCodes_name_1",
"eHichERgchCodes_name_2", "eHichERgchCodes_name_3",
"eulMaxTargetRtwp"
}-->
<xsl:template name="sequenceNameString">
<xslaram name="sequenceName"/>
<xslaram name="maxCount"/>
<xslaram name="value"/>
<!--<xslaram name="arrayMax" select="$maxCount"/>-->
<!--<xsl:if test="$value <= $arrayMax">-->
<xsl:if test="$value <= $maxCount">
<xsl:text>"</xsl:text>
<xsl:value-of select="concat(concat($sequenceName,'_name_'),$value)"/>
<xsl:text>"</xsl:text>
<!--<xsl:if test="$value != $arrayMax">-->
<xsl:if test="$value != $maxCount">
<xsl:text>,</xsl:text>
</xsl:if>
<xsl:call-template name="sequenceNameString">
<xsl:with-param name="value" select="$value + 1"/>
<xsl:with-param name="sequenceName" select="$sequenceName"/>
<xsl:with-param name="maxCount" select="$maxCount"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
Template for value:
===================
<xsl:template name="sequenceValueObject">
<xslaram name="sequenceName"/>
<xslaram name="maxCount"/>
<xslaram name="dataType"/>
<xslaram name="value"/>
<xsl:if test="$value <= $maxCount">
<xsl:choose>
<xsl:when test="$dataType = 'long'">
<xsl:text>new Integer</xsl:text>
</xsl:when>
<xsl:when test="$dataType = 'boolean'">
<xsl:text>new Boolean</xsl:text>
</xsl:when>
<xsl:when test="$dataType = 'string'">
<xsl:text>new String</xsl:text>
</xsl:when>
<xsl:when test="$dataType = 'longlong'">
<xsl:text>new Long</xsl:text>
</xsl:when>
<xsltherwise><xsl:call-template name="notImplemented">
<xsl:with-param name="sequnceName" select="$sequenceName"/>
<xsl:with-param name="error" select="$dataType"/>
</xsl:call-template></xsltherwise>
</xsl:choose>
<xsl:text>(</xsl:text>
<xsl:value-of select="concat($sequenceName,concat('_value [',$value))"/>
<xsl:text>])</xsl:text>
<xsl:if test="$value != $maxCount">
<xsl:text>,</xsl:text>
</xsl:if>
<xsl:call-template name="sequenceValueObject">
<xsl:with-param name="sequenceName" select="$sequenceName"/>
<xsl:with-param name="value" select="$value + 1"/>
<xsl:with-param name="maxCount" select="$maxCount"/>
<xsl:with-param name="dataType" select="$dataType"/>
</xsl:call-template>
</xsl:if>
</xsl:template>