Subject: [xsl] Tag with no data or missing tag - supply default From: "Mila P. Mitra" <pmitra@xxxxxxxxxxxxxxxxx> Date: Thu, 16 Sep 2004 15:48:45 -0700 |
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> --+--
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] attribute length, Dimtre Novatchev | Thread | RE: [xsl] Tag with no data or missi, cknell |
RE: [xsl] performance issues and se, Michael Kay | Date | RE: [xsl] Tag with no data or missi, cknell |
Month |