You may do something like(not tested):

<xslt:variable name="n2">

            <xslt:choose>

                        <xslt:when test="0 = string-length(age)">NA</xslt:when>

                        <xslt:otherwise><xslt:value-of select="age" /></xslt:otherwise>

            </xslt:choose>

<xslt:variable>

 

Note that n2 will contain a string rather than an element reference.

 

Regards,

Dennis JD Myrén

Developer

Oslo Kodebureau

Tel:      (+47) 98 00 11 92

Mail:   [EMAIL PROTECTED]

Web:   www.oslokb.no


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 16. september 2004 08:55
To: [EMAIL PROTECTED]
Subject: Checking for EMPTY tag

 

Hi everybody,

 

           I have the following tags.

 

            <stdudent>

                        <name>Bhaskar</name>

                        <age>25</age>

                        <college>MSRIT</college>

            </student>

 

            <stdudent>

                        <name>Appu</name>

                        <age></age>

                        <college>RVCE</college>

            </student>

 

            Since age tag of second is empty. I want display the empty tag as ‘NA’.

            Please help how to handle this.

 

            Output what I need is:

 

            Bhaskar:25:MSRIT

            Appu:NA:RVCE      

 

            What it did is it put the content of name, age, college tags to variables n1, n2, n3.

            <xsl:variable name=”n1” select=”name”/>

            <xsl:variable name=”n2” select=”age”/>

            <xsl:variable name=”n3” select=”college”/>

 

            Tell me now how to check for empty. If empty I have replace it with NA.

 

           

 

Thanks in advance.

 

Bye,

Bhaskar

 

 

DISCLAIMER:
This message contains privileged and confidential information and is intended only for the individual named.If you are not the intended recipient you should not disseminate,distribute,store,print, copy or deliver this message.Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted,corrupted,lost,destroyed,arrive late or incomplete or contain viruses.The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version.

Reply via email to