aspose file tools*
The moose likes XML and Related Technologies and the fly likes <xsl:if> tag problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "<xsl:if> tag problem" Watch "<xsl:if> tag problem" New topic
Author

<xsl:if> tag problem

name agarwal
Greenhorn

Joined: May 22, 2011
Posts: 2
Hi,

I am writing an XSL document, using which I need to print a report.

The report will have two tables and the table values and lables/header column should be displayed only if there is data in my JAVA object of class "Transfers".

I thought of using <xsl:if> condition to check if there is any data in the object of class Transfers, and then if there is no data then I will not print the table. But it dosent seems to work.
I am not sure how can I check for object "transfers" of class "Tranfers" as null.(i.e. whether the object has any value or it is null)

I tried below things, but it didnt work
<xsl:if test="transfers!=null">
<xsl:if test="not(transfers)">


If anyone has any other idea to do it, then please suggest.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18141
    
    8

But wouldn't you be transforming an XML document? In which case all of that talk of "data in my Java object" would be irrelevant or at least misleading. Look at the XML document you're transforming, and ask questions about that if you can't figure it out.
name agarwal
Greenhorn

Joined: May 22, 2011
Posts: 2
My XML looks as below:



I want to check whether tag <transfers> exist in my XML document.
If the element <transfers> does not exist then its coressponding child elements(prod-no, quantity) will also not exist.

Please tell me how can I check this?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18141
    
    8


checks whether the context node has a child element named "transfers".
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: <xsl:if> tag problem
 
Similar Threads
Populate Excel Spreadsheet
If not null - need help with rule.....
jTextField update text?
Adding data using hibernate for Composite primary keys
Using variable to hold a boolean test