Subject: RE: [xsl] If vs. apply-templates for optional attributes From: "Hunsberger, Peter" <Peter.Hunsberger@xxxxxxxxxx> Date: Fri, 7 Jun 2002 10:11:55 -0500 |
> <testelement>> > ^ you have a spare > here Typo while creating the e-mail... > > > <xsl:template match="xxx"> > <xxx attr="default"> > <xsl:copy-of select="@*"/> > .. > </xxx> > > which will mean that xxx has the attributes from the source, plus > possibly attr="default" if teh source did not have that attribute. Yes, but that doesn't help if the source also has specified the attribute. In that case I'd end up with it defined twice... > 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">. In this particular case, the attribute is either going to exist with a value or not be specified at all, but yes, the example was a little inconsistent. The tests can be made consistent without affecting the real question: does the apply-templates method have any significant performance implications? XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] If vs. apply-templates fo, Hunsberger, Peter | Thread | Re: [xsl] If vs. apply-templates fo, Jeni Tennison |
[xsl] Organization Chart, markgoldin | Date | Re: [xsl] Newbie: See if a node exi, Joerg Heinicke |
Month |