Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - ignore empty tags >Thread Next - Re: ignore empty tags Re: ignore empty tagsTo: NULL Date: 6/3/2005 5:14:00 AM Raj wrote: > Hi > > I have had a quick look at the posts and have not found an answer yet. > > I have the following XML in two different files: > > file1: > > <row> > <Desc>Missing from us</Desc> > <Building>82</Building> > <T>8.40</T> > <Billref>009530393</Billref> > <Postcode>SE10 8QW</Postcode> > </row> > > file2: > > <row> > <Desc>Missing from us</Desc> > <T>108.10</T> > <Billref>904158</Billref> > </row> > > > And the following in an XSL stylesheet: > > <xsl:template match="/one/miss/table/row"> > <tr> > <td align="left" class='bodyrow'><xsl:value-of select="Desc"/></td> > <td align="left" class='bodyrow'><xsl:value-of select="Billref"/></td> > <td align="right" class='bodyrow'><xsl:value-of select="T"/></td> > <xsl:if test="Building[.='']"> > <td align="left" class='bodyrow'><xsl:value-of select="Building"/></td> > </xsl:if> > <xsl:if test="Postcode[.='']"> > <td align="left" class='bodyrow'><xsl:value-of select="Postcode"/></td> > </xsl:if> > </tr> > </xsl:template> > > So that file1 will display 5 columns in a table and file2 only 3. This > worked correctly with file1 before I added the if statements to accommodate > file2 with the same stylesheet. Noe file2 displays correctly, but file1 > shows no Building or Postcode data. > > Any help would be appreciated. > > Regards, Instead of <xsl:if test="Postcode[.='']"> ... Try <xsl:if test="Postcode"> ... Regards, N. Demos -- Change "seven" to a digit to email me. | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
