RE: [xsl] call-template returns nothing was [Newbie question]

Subject: RE: [xsl] call-template returns nothing was [Newbie question]
From: "David at roamware" <david@xxxxxxxxxxxxxx>
Date: Mon, 6 Dec 2004 20:07:42 -0000
Sorry about that, sent before its time
As I was saying, you were right it was

	<xsl:if test="not(SecuritiesMovement/DebitCreditIndicator/node())">

I wanted.

It works beautifully now, to think I knew nothing about XSLT yesterday,
thanks for your help.

David

-----Original Message-----
From: David Wynter [mailto:david@xxxxxxxxxxxxx]
Sent: 06 December 2004 20:05
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] call-template returns nothing was [Newbie question]


Thanks George,

I am rapidly getting the hang of this, I had worked out the $ reference and
that to output you either use <xsl:value-of select="$name"/>, for test yuo
also need to refer to the $name.

I may have misinformed, it was


-----Original Message-----
From: George Cristian Bina [mailto:george@xxxxxxx]
Sent: 06 December 2004 19:52
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] call-template returns nothing was [Newbie question]


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

Current Thread