Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Stop printing HTML

Status
Not open for further replies.

deepasona

Programmer
Apr 22, 2003
7
0
0
IN
Dear ALL,
I've problem in printing the HTML.
I've an XML which has a tag named Value.

And in the Java Code, I used to print the HTML applying the XSL I have on the XML.

My Problem is.
If the Value tag has value as 0. I shouldn't print the HTML. Can this be done using XSL?

Regards,
Viji.
 
[tt]
<xsl:if test=&quot;value &gt; 0&quot;>
<!-- YOUR HTML GOES HERE -->
</xsl:if>
[/tt]
 
That > should be & g t ;

Code:
      <xsl:if test=&quot;price &gt; 10&quot;>
        <!-- YOUR HTML GOES HERE -->
      </xsl:if>
[code]
 
Hello,
Thanks for ur response. But my question is I shouldn't generate the HTML if the Value is 0.

For Eg:
This is my first XML.
<Products>
<Product>
<Name>Five Star</Name>
<Value>10</Value>
<Product>
<Name>Munch</Name>
<Value>10</Value>
</Product>
<Products>

This is my second XML.
<Products>
<Product>
<Name>XXC</Name>
<Value>0</Value>
</Products>


Now I have my XSL, which will print the HTML.

Product Name Amount
Five Star 10
Munch 10


This is a valid HTML. But see for Second XML. It will be like

Product Name Amount
XXC 0

There is no point in printing this HTML. So I don't want this HTML. But my XSL code is going to be same for all the XMLs. So how will I stop printing the HTML using the XSL code when the value is 0?

Regards,
Viji.
 
Well, your question would be better phrased as &quot;how do I only print html where the value is greater than 0?&quot; XSL is about what you want to display rather than what you don't want to display. Therefore it makes sense to only print html where the value is greater than 0, as opposed to not printing html where the value is 0. Same result, but if your mindset is running in the opposite direction to the way the development environment is set up, you will run into lots of problems.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top