[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Null Values

Subject: RE: Null Values
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Fri, 30 Mar 2001 10:55:43 +0100
xsl is null
> My requirement is to remove tag names when I convert from one
> xml to another
> xml, if there is no data.
> e.g
> <F1>1234</F1>
> <F2>1234</F2>
> <F3></F3>
> <F4>1234</F4>
>
> to
>
> <F1>1234</F1>
> <F2>1234</F2>
> <F4>1234</F4>
>
It's rather important to learn the correct terminology here, because it will
help you to understand the specs. Talking about "tag names" suggests you're
thinking in terms of the serialized XML rather than its tree structure,
which will get you into all sorts of conceptual confusion.

What you are actually trying to remove is an element node. And in fact you
don't need to remove it, you just need to refrain from copying it.

The way you do this depends on how you are copying the other nodes. If
you're doing it using template rules, the simplest way is to have an
overriding template rule that matches elements with "no data" (which we
might interpret as meaning no child element or text nodes), and does
nothing:

<xsl:template match="*[not(* or text())]" priority="17"/>

Mike Kay
Software AG



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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.