Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XSLT Output - blank attributes

From: Peter Flynn <peter.nosp@-.--------.-->
To: NULL
Date: 7/3/2006 2:37:00 AM

requeth@g... wrote:
> Allo,
> 
> I'm somewhat new to XSLT but I am doing fairly well. I just got stuck
> on one item. I have created a XSL stylesheet to pull information from
> an XML file and generate a report. I would like to add functionality
> for missing data, in which if the attribute contains nothing ("") then
> the field is red. I added in a choose function which flags it red, but
> only if the attribute itself was not populated into the source file. Is
> there a way to flag both if the attribute has not populated and if it
> is just a blank attribute (""). If you know the answer to this, is
> there a term for just "" that I could search more on?

There may be more than presence or absence at work here.

If the DTD or Schema defines a default value for the attribute,
then the processor will behave as though the attribute was
specified with that value, even if it's physically absent from
the document.

<xsl:if test="@foo=''"> will only be true if
(a) foo="" is actually in the document, or
(b) the null string is declared as the default value

<xsl:if test="@foo"> will only be true if
(a) foo="" or foo="something" is actually in the document, or
(b) foo is declared with a default value (of any kind)

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


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