|
Subject: Re: [xsl] If vs. apply-templates for optional attributes From: David Carlisle <davidc@xxxxxxxxx> Date: Fri, 7 Jun 2002 15:57:08 +0100 |
<testelement>>
^ you have a spare > here (which means teh following
xs:attriibute is a syntax error.
<xsl:if test="@attr != ''">
I think you just want
<xsl:template match="xxx">
<xxx attr="default">
<xsl:copy-of select="@*"/>
..
</xxx>
</xsl:template>
which will mean that xxx has the attributes from the source, plus
possibly attr="default" if teh source did not have that attribute.
Note I'm not sure if that's quite what you want as your two code
examples used different tests
one had not(@attr)
and the other had "@attr != ''
attr=""
would be false for both of those. Which you want depends on whether
you want an empty attribute (as well as a missing attribute) to be
replaced by <xxx attr="default">.
David
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] If vs. apply-templates for op, Hunsberger, Peter | Thread | Re: [xsl] If vs. apply-templates fo, Jeni Tennison |
| Re: [xsl] Is this right for a key?, jestoll | Date | RE: [xsl] If vs. apply-templates fo, Dunning, John |
| Month |