xsl-list
[Top] [All Lists]

RE: Output a default value for an empty node

2004-10-06 06:20:01
There's a typo...

<xsl:template match="foo">
 <xsl:copy-of select="."/>
</xsl:template>

<xsl:template match="foo[not(text())]">
 <foo>hello mum</foo>
</xsl:template>

Cheers,
<prs/> 

-----Original Message-----
From: David Carlisle [mailto:davidc(_at_)nag(_dot_)co(_dot_)uk] 
Sent: Wednesday, October 06, 2004 6:07 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Output a default value for an empty node


<xsl:template match="foo">
 <xsl:copy-of select="."/>
</xsl:template>
 
<xsl:template match="foo[not(text()]">
 <foo>hello mum</foo>
</xsl:template>
 
will convert

<foo>zzz</foo> to <foo>zzz</foo>
and
<foo/>         to <foo>hello mum</foo>

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The service is powered
by MessageLabs. For more information on a proactive anti-virus service
working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

--+------------------------------------------------------------------
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>
--+--