[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Tag with no data or missing tag - supply default
Hello, I would like some help on how to use a stylesheet to supply a default value if there is a certain element tag with no data within it, or if the element is missing altogether. For example, here is an xml document extract. I would like the output to always have a tag for <test> and if it doesnt find a value to insert a default value of 'fail' in it. This is bacause my output file will become input to another program which needs that tag and a default value. I would appreciate it if someone could please help me with the xsl code that could do this transformation (formatting, i.e. whether output is HTML or XML or text does ot matter, I can do that part): <record1> <test>pass</test> <data>zzz</data> <record1> <record2> <test></test> <data>xxx</data> </record2> <record3> <data>yyy</data> </record3> Desired output: record1: pass zzz record2: xxx fail record3: yyy fail Thanks in advance, Mila --------------------------------------------- Mila (Patralekha) Mitra 650.604.1814 Northrop Grumman IT, NASA Ames, CA --+------------------------------------------------------------------ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/ or e-mail: <mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx> --+--
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|