[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] Null Values
Subject: Re: [xsl] Null Values From: Mike Brown <mike@xxxxxxxx> Date: Thu, 29 Mar 2001 14:23:47 -0700 (MST) |
Lawrence Pravin wrote: > 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> > > Is there any general method to do this, instead of checking node by node. You could avoid selecting the nodes for processing in the first place. For example, <xsl:template match="foo"> <xsl:apply-templates select="*[normalize-space()]"/> </xsl:template> would select only the element children of the current 'foo' element if they have non-empty string-values, after normalization of whitespace. Alternatively, process all the elements, but use different templates for the empty and non-empty ones: <xsl:template match="*[normalize-space()]"> <xsl:copy-of select="."/> </xsl:template> <xsl:template match="*[not(normalize-space())]"/> <!-- does nothing --> - Mike _____________________________________________________________________________ mike j. brown, software engineer at | xml/xslt: http://skew.org/xml/ webb.net in denver, colorado, USA | personal: http://hyperreal.org/~mike/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Null Values, Wendell Piez | Thread | RE: [xsl] Null Values, Michael Kay |
Re: [xsl] When test expression, Paul Dupuy, Jr. | Date | RE: [xsl] xml to html paragraphing, Chris Bayes |
Month |
Keywords