Altova Mailing List Archives>Archive Index >xsl-list Archive Home >Recent entries >Thread Prev - RE: [xsl] How to prevent copying non-existing elements? [Thread Next] RE: [xsl] How to prevent copying non-existing elements?To: xsl-list@-----.------------.--- Date: 8/4/2009 2:48:00 PM Hi, At 09:03 AM 8/4/2009, Mike wrote: > > In pseudo code I need something like > > > > <xsl:template match="/"> > > .... > > "if /moxx:aaa/moxx:bbb exists" then ( > > <moxx:someelement> > > <xsl:value-of select="/moxx:aaa/moxx:bbb"/> > > </moxx:someelement>) > > .... > > > > How can I code this in XSLT ? > > > > <xsl:if test="/moxx:aaa/moxx:bbb"> > <moxx:someelement> > <xsl:value-of select="/moxx:aaa/moxx:bbb"/> > </moxx:someelement> > </xsl:if> Or, somewhat more idiomatically, <xsl:for-each select="/moxx:aaa/moxx:bbb"> <moxx:someelement> <xsl:value-of select="."/> </moxx:someelement> </xsl:if> Note these also have slightly different behaviors if more than one /moxx:aaa/moxx:bbb exists. Cheers, Wendell ====================================================================== Wendell Piez mailto:wapiez@m... Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ====================================================================== --~------------------------------------------------------------------ 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@l...> --~-- | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
