xsl-list
[Top] [All Lists]

Re: [xsl] Transform all tags into attributes with some tags omitted

2008-05-16 04:54:53
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

--~------------------------------------------------------------------
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(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--