[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: How to delete empty element tag from output XML?


Subject: RE: How to delete empty element tag from output XML?
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Thu, 26 Oct 2000 11:20:29 +0100

> You may notice 
> 1). if <Sex> is empty as in Amy case, don't print <Gender /> 
> 2). if <N3> is empty as in Tom case, I need a output 
> <MI>N/A</MI>, i.e. a
> default of "N/A".
> 3). the structure and tag of output different with input.

> As I mentioned before, the last thing I want to do is use 
> <xsl:if> in XSLT
> stylesheet to compare every segment because it's too tedious 
> given the fact I have numberous tags need to process.

XSLT isn't magic, if you have lots of rules you will have to write lots of
code.

But your rules above look just like template rules, so rather than writing
lots of <xsl:if> statements I would write lots of rules.

e.g. 
Rule 1: <xsl:template match="Sex[.='']"/>
Rule 2: <xsl:template match="N3[.='']><MI>N/A</MI></xsl:template>

Mike Kay


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords