• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

<xsl:if> tag problem

 
name agarwal
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 20971
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 20971
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

checks whether the context node has a child element named "transfers".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic