Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - XSLT Output - blank attributes [Thread Next] Re: XSLT Output - blank attributesTo: 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/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
