Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Testing Whether An Element Exists Or Has Value

From: "Joe Fawcett" <joefawcett@----------.------>
To: NULL
Date: 5/9/2005 10:13:00 AM
"MDW" <MDW@d...> wrote in message 
news:A3B198F8-333D-4AE7-B17C-29CA672E3018@m......
> Hey all,
>
> I'm just starting out with XML/XSL, so I apologize if this is a stupid
> question. I'm working on formatting some XML documents for display on the Web
> (I doubt there will be any other use of them for any other application).
>
> I'm creating several documents that will have a CreatedDate element. Also,
> if there has been a change since the doc was created, there may also be a
> LastModified element. On the Web page, I want to display something like this:
>
> "Created: 12/23/2003
> Last Modified: 04/27/2004"
>
> but obviously, if something hasn't been modified, I don't want to display
> that second line. How, in XSL, can I test whether the LastModified element is
> there? (It also may be there, but be empty.)
>
> Thanks.
> -- 
> Hmm...they have the Internet on COMPUTERS now!
<xsl:if test="LastModified != ''">
  <!-- do something -->
</xsl:if>

You may need to modify the XPath to match your context node. If you just want to 
test if the element exists at all use:
test="LastModified".


http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html/conXSLT.asp?frame=true


-- 

Joe (MVP - XML)

https://mvp.support.microsoft.com/profile=8AA9D5F5-E1C2-44C7-BCE8-8741D22D17A5 




transparent
Print
Mail
Like It
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