xsl-list
[Top] [All Lists]

Re: call-template returns nothing was [Newbie question]

2004-12-06 12:52:14
Hi David,

If you want to refer to a parameter or to a variable you should use $ before the parameter or variable name:

So instead of

<xsl:template name="funcmsglookup">
    <xsl:param name="codef"/>
    <xsl:if test="codef=0">
        <xsl:text/>NEWM</xsl:if>
    <xsl:if test="codef=1">
        <xsl:text>REPL</xsl:text>
    </xsl:if>
    <xsl:if test="codef=2">
        <xsl:text>CANC</xsl:text>
    </xsl:if>
</xsl:template>

you should write:

<xsl:template name="funcmsglookup">
    <xsl:param name="codef"/>
    <xsl:if test="$codef=0">
        <xsl:text/>NEWM</xsl:if>
    <xsl:if test="$codef=1">
        <xsl:text>REPL</xsl:text>
    </xsl:if>
    <xsl:if test="$codef=2">
        <xsl:text>CANC</xsl:text>
    </xsl:if>
</xsl:template>

and change also all the the other places in your stylesheets where you use parameters or variables. Otherwise, codef=1 for instance will check if there is an element codef as child of the current element having its content 1.

To test for an empty element you can use not(element/node()) where element should be replaced with the actual element you are checking, but I'm not sure that you want this because there is no empty SecuritiesMovement element in your sample.

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com


David at roamware wrote:
Hi,

I stripped out the namespace form th exml and it redners oputput, but none
of my xsl:call-template seems to work. I know th eselect for the param is
working as I tried outouting the select as a value-of and it output, so
assume therefore that the select content is being forwarded to the template
being called. But as I put the name of the param on it's own in the template
being called either as name or $name I get that literal output, not the
value of the select passed in?

A second problem I noticed. The first 4 apply-templates match to,
respectively 1 GeneralInformationBlock, 1 UnderlyingSecurities, 1
CorporateActionDetail and 2 CorporateActionOption. In the 2
CorporateActionOption I test for empty element using <xsl:if
test="t:SecuritiesMovement!=''"> and <xsl:if
test="t:CashPaymentDetails!=''">, but these do not seem to be working the
output inside the xsl:if is being called regardless.

Thx.

David

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>