[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Philipp Kursawe schrieb:
<xsl:template match="*[ . = '' ]" mode="attr"/><!-- empty -->
And, of course, you'll have to set up templates accordingly.
Michael Ludwig
Re: [xsl] Transform all tags into attributes with some tags omitted
Subject: Re: [xsl] Transform all tags into attributes with some tags omitted From: Michael Ludwig <mlu@xxxxxxxxxxxxx> Date: Fri, 16 May 2008 13:52:59 +0200 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Transform all tags into a, Philipp Kursawe | Thread | Re: [xsl] Transform all tags into a, David Carlisle |
Re: [xsl] Transform all tags into a, Philipp Kursawe | Date | Re: [xsl] Transform all tags into a, David Carlisle |
Month |