Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XSL If Statement

From: Peter Flynn <peter.nosp@-.--------.-->
To: NULL
Date: 2/14/2007 12:55:00 AM

RigasMinho wrote:
> Hello,
> I have an XML file with the following Data:
> 
> <headerinfo title='Name'>John</headerinfo>
> <headerinfo title='Name'>Raymond</headerinfo>
> I then use the following to grab the information and display it:
> <td>
> <xsl:value-of select="infoObjectDetail[@title =Name']"/>
> <xsl:text>&#160;</xsl:text>
> </td>

That doesn't make sense. What's infoObjectDetail? Did you mean 
headerinfo? And it's not well-formed: you're missing an open-quote 
before Name.

> Which displays John | Raymond
> 
> How do I make it so that if "John" is in the XML - it skips it over
> and doesnt print that line?

Use a conditional statement.

> I tried a bunch of different if statments but havent found a right way
> to do this yet.

If you read the documentation you'll find it much easier than guessing.

<xsl:if test="headerinfo[@title='Name']!='John'">
   <xsl:value-of select="headerinfo[@title='Name']"/>
   <xsl:text>&#160;</xsl:text>
</xsl:if>

Or perhaps test="not(contains(headerinfo[@title='Name'],'John'))"

///Peter
-- 
XML FAQ: http://xml.silmaril.ie/


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent