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

Re: Transform all tags into attributes with some tags

Subject: Re: Transform all tags into attributes with some tags omitted
From: Michael Ludwig <mlu@xxxxxxxxxxxxx>
Date: Fri, 16 May 2008 13:52:59 +0200
Re:  Transform all tags into attributes with some tags
Philipp Kursawe schrieb:
wonderful! This works! How can I ommit empty tags? They should not be
converted to attributes.

Throw in another template to suppress element nodes the string value of which is the empty string:

<xsl:template match="*[ . = '' ]" mode="attr"/><!-- empty -->

Note this presupposes you do not have any child elements attached to the
element nodes matched by the above template, not to mention attributes
and other children. If, however, you do, then you must ensure processing
continues in the same mode by nesting:

    <xsl:apply-templates select="*" mode="attr"/>         or:
    <xsl:apply-templates select="node()|@*" mode="attr"/>

And, of course, you'll have to set up templates accordingly.

Michael Ludwig

Current Thread


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.
First Name
Last Name
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.