Subject: RE: [xsl] default attribute values? From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Fri, 02 Aug 2002 17:25:47 -0400 |
> In fact if you used templates instead of the copy-of, you could generalize > this for all the attributes: > > <input name="default" name2="default2"> > <xsl:apply-templates select="@*"/> > </input> > > <xsl:template match="node/@*"> > <xsl:copy-of select="."/> > </xsl:template> > > <xsl:template match="@gunk" priority="1"> > <xsl:attribute name="name"> > <xsl:value-of select="."/> > </xsl:attribute> > </xsl:template> > > Note that on the template for the attribute whose name is changing (@gunk > to @name), an explicit priority is necessary to make sure that template > fires instead of the template that copies.
Wendell, that's a bit obscure (thus, I like it), but it probably makes sense where you're doing a lot of attribute manipulation. In particular, if you changed the name of a certain set of attributes on multiple different elements. The choose block certainly makes it more obvious what's going on and I'd guess it's likely is more efficient for the case where you're only flipping the name on a single attribute for a single element...?
Cheers, Wendell
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx 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 ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] default attribute values?, Hunsberger, Peter | Thread | [xsl] merge tree structure with no , Benoit Guyon |
[xsl] Capturing/testing results of , Edward L. Knoll | Date | Re: [xsl] Capturing/testing results, Wendell Piez |
Month |