[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Printing Null Values with XSLT

Subject: RE: Printing Null Values with XSLT
From: "Reich, Eric" <ereich@xxxxxxxxxxxxxx>
Date: Fri, 13 Oct 2000 09:17:32 -0400
xslt null value
Wow!! Mike, I can't believe you responded to my question. I have your
book (just purchased two weeks ago) and to have you reply to my question
has me star struck! So, many thanks for responding!

Anyway...my problem stems from an XML document that has 3 attributes
with 3 values. My ultimate goal is to display the output in a table
using HTML. Now, at various points throughout my XML document these
same attributes and values appear; thus, my output in HTML will have
multiple tables. But, at some points in the XML document, the attributes
have no value at all (ie, Abstract=" " or Name=" "). They way I have 
my HTML is like the following:
<TABLE border="1">
 <TR>
  <xsl:for-each select="ATTRIBUTE">
   <TD>
    <TABLE border="1">
     <TR>
      <TH>
       <xsl:value-of select="NAME"/>
      </TH>
     </TR>
     <TR>
      <TD>
       <xsl:value-of select="VALUE"/>
      </TD>
     </TR>
    </TABLE>
   </TD>
  </xsl:for-each>
 </TR>
</TABLE>

The output is as follows:

Row1: Name		Default	Abstract
Row2: ProductId			true

Now, what I want to happen is to add some XSLT language that would
be able to not print, say, a Default column if, and only if, there
is no value associated it to it. If it does find it, then it prints
it. Does that makes sense? So, in the above scenario, the Default
column would not be seen in the browser.

I will try to test what you provided me here. I will also look in
your book for additional information.

Many thanks, Mike!!!

Eric




-----Original Message-----
From: Kay Michael [mailto:Michael.Kay@xxxxxxx]
Sent: Friday, October 13, 2000 5:12 AM
To: 'xsl-list@xxxxxxxxxxxxxxxx'
Subject: RE: Printing Null Values with XSLT


> The Scene:        On row1, I have these headers: Name, 
> Default, Abstract,
> Description
>                          On row2, I have these datas:    
> Prods,            ,
> true      , The Prods Number
>  
> The Problem:    I want to ad XSLT language to my HTMLout.xsl 
> file that will query the values (shown
>                         as the datas above) and, if it finds 
> an empty value, then the system will print nothing
>                         for that specific data.
>  
> The Solution:    

What do you want it do do if it DOESN'T find an empty value?

Normally <xsl:value-of select="Description"/> will achieve the required
effect.
Or try something like:

<xsl:choose>
<xsl:when test="Description">... do something ...</xsl:when>
<xsl:otherwise><!-- do nothing --></xsl:otherwise>
</xsl:choose>

Mike Kay 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.