Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: ignore empty tags

From: "Raj" <raj.kothary@----.--->
To: NULL
Date: 6/6/2005 9:31:00 AM
"N. Demos" <stormbringer_seven@h...> wrote in message 
news:8GRne.881431$w62.143038@b......
> 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">

Hey, that worked!  Thanks for your help.

Kind regards,
Raj 




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent