diff options
author | Suchita Lad | 2025-02-06 17:03:41 +0530 |
---|---|---|
committer | Suchita Lad | 2025-02-07 11:37:01 +0530 |
commit | b689daef5e0d636b055fe985c91e86d43713940c (patch) | |
tree | 0377535715e7c727a029ab6062bffde148405e5c | |
parent | afab8c336498c640e29aa8d45fe2690d0f605123 (diff) | |
download | Common-Interface-Project-b689daef5e0d636b055fe985c91e86d43713940c.tar.gz Common-Interface-Project-b689daef5e0d636b055fe985c91e86d43713940c.tar.bz2 Common-Interface-Project-b689daef5e0d636b055fe985c91e86d43713940c.zip |
Updated head.xsl file for si_format
-rw-r--r-- | blocks/xcos2xml/head.xsl | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/blocks/xcos2xml/head.xsl b/blocks/xcos2xml/head.xsl index f170bc2c..b5bf71f0 100644 --- a/blocks/xcos2xml/head.xsl +++ b/blocks/xcos2xml/head.xsl @@ -416,8 +416,9 @@ <xsl:choose> <xsl:when test="$absNum = 0">0</xsl:when> <xsl:otherwise> - <xsl:call-template name="log"> - <xsl:with-param name="pX" select="$absNum"/> + <xsl:call-template name="compute-exp"> + <xsl:with-param name="n" select="$absNum"/> + <xsl:with-param name="exp" select="0"/> </xsl:call-template> </xsl:otherwise> </xsl:choose> @@ -456,6 +457,29 @@ </xsl:otherwise> </xsl:choose> </xsl:template> + <!-- Recursive template to compute the exponent --> + <xsl:template name="compute-exp"> + <xsl:param name="n"/> + <xsl:param name="exp"/> + + <xsl:choose> + <xsl:when test="$n < 1"> + <xsl:call-template name="compute-exp"> + <xsl:with-param name="n" select="$n * 10"/> + <xsl:with-param name="exp" select="$exp - 1"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="$n >= 10"> + <xsl:call-template name="compute-exp"> + <xsl:with-param name="n" select="$n div 10"/> + <xsl:with-param name="exp" select="$exp + 1"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$exp"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> <xsl:output method="xml" indent="no" /> <xsl:key name="k-in" match="ExplicitInputPort | ImplicitInputPort" use="@parent" /> |