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 Tel: (+47) 98
00 11 92 Mail: [EMAIL PROTECTED] Web: www.oslokb.no From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 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: |
- Checking for EMPTY tag KS.Bhaskar
- RE: Checking for EMPTY tag Dennis Myrén