I'm rather new to XML and apologies if it's not up to scratch.


The following is my code, which just doesn't seem to work. And I think I know why. I am trying to have it set so that if there is a shipID then the shipping address should show, on the table/div, but if there is a contact number instead this should show. I think it may be something to do with the 'shipID' as it is stated as 'less than' but I have since made the ShipID text and NOT a number. Is there a way to basically say "If there is a shipID then show this" instead of it having to be 'if there is a ship number less than"?


Cheers.



<tr style= "color:white; background:yellow;">
<th> header 1</th>
<th> header 2</th>
<th> header 3</th>
</tr>
<xsl:for-each select="shipping">
<xsl:choose>
<xsl:when test="shipID &lt; '2'">
<tr style="color:black;">
<td>
<xsl:value-of select="header 1"/>
</td>
<td>
<xsl:value-of select="header 2"/>
</td>
<td>
<xsl:value-of select="header 3"/>
</td>
</tr>
</xsl:when>

<tr style= "color:white; background:yellow;">
<th> contact 1</th>
<th> contact 2</th>
<th> contact 3</th>
</tr> <xsl:otherwise>
<xsl:for-each select="contacts">
<tr style="color:black;">
<td>
<xsl:value-of select="contact1"/>
</td>
<td>
<xsl:value-of select="Contact2"/>
</td>
<td>
<xsl:value-of select="Contact3"/>
</td>
</tr>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>

No comments:

Post a Comment