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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to tag <a href="<xsl:value-of select='FacilityID" />&quot 2

Status
Not open for further replies.

qajussi

Programmer
Mar 22, 2004
236
US
Hi I am writing a XSL page.
I don't know how to handle <a href> tag
I want to tag <xsl:value-of select='AffiliatedFacilityID'/> in the <a href="">.

Another question.
How can I check if <xsl:value-of select='AffiliatedFacilityID'/> is equal to zero or not?

This is how I write..
<table><tr>
<td align="left"><b>Website: </b></td>
<td>
<xsl:value-of select="Website"/>
</td>
</tr></table>
I want to check if <xsl:value-of select="Website"/> is empty and if it is empty, I don't want to print out <b>Website: </b>

How would you code this kind of siutation?

your input is greatly appreciated.
Thanks millions in advance.



 
try:
<a href='{AffiliatedFacilityID}'>blah</a>

I had the same question the other day... finally figured it out on my own...

I'm still looking for the other part of the question, myself...

I will post back if I find it ;-)


PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
Thanks millions, CubeE101!
It works.

On the second question, I am not sure if I need to check for the empty value using script or is there another way to do it.

Let me know if you get to figure this out.
Thanks again.
 
<table><tr>
<td align="left">
<xsl:if test="Website!=''"><b>Website: </b></xsl:if>
</td>
<td>
<xsl:value-of select="Website"/>
</td>

</tr></table>
 
I think I would do it more like this:
Code:
<table>
 [b]<xsl:if test="Website">[/b]
  <tr>
   <td align="left">
    <b>Website:</b>
   </td>
   <td>
    <xsl:value-of select="Website"/>
   </td>
  </tr>
 [b]</xsl:if>[/b]
</table>

1.) You don't need the: != '', it actually works better, in most cases, if you leave it off...
2.) I would surround the whole <TR> with the <xsl:if> tag... That way you don't have a blank row...

Hope this helps ;-)
-Josh

Visit My Site
PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
Whoops... I take that back...

I was thinking about something else...

If you need to know if it is BLANK and not just if it EXISTS....
use the method JontyMC described with the != ''

Sorry about that, I've been working on a project that is just checking whether nodes exist or not... regardless of if they are blank or not...

basically...

Exists:
<xsl:if test="Website">
Exists AND non-blank:
<xsl:if test="Website != ''">

I would put spaces between the Website, !=, and '' though...
Otherwise, some expressions can cause trouble...

Visit My Site
PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
Thank you so much.
I didn't know how to use the "test=".
I am testing it right now.

This will help me a lot.
I have been spending hours to go back and delete those empty rows...one with the empty content from the XML tags.
Thanks million.
 
OK.
Thanks for the correction.
So use
<xsl:if test="Website">
to see if <Website> node exist.
and use
<xsl:if test="Website != ''">
to see if <Website> node and its content exist.

Thanks again.

 
You got it!

Thanks for the star...

Good Luck!
-Josh

Visit My Site
PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top