This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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


> 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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]