Subject: RE: [xsl] Copy Attribute Unless From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Fri, 25 Mar 2005 18:41:20 -0000 |
> The following works in Saxon 8.0. I assumed it was bad news to > specify an attribute twice, but I suppose the last attribute > node copied wins. > > <xsl:template match="control"> > <xsl:variable name="definition" > select="ancestor::bench/fixture/control-point[ > @name = current()/@name]"/> > <xsl:copy> > <xsl:copy-of select="$definition/@*"/> > <xsl:copy-of select="@*"/> > </xsl:copy> > > </xsl:template> Yes, XSLT 2.0 (and 1.0 for that matter) specifies that you can add two attributes with the same name to an element, and the last one wins. It's safe to rely on this - this is standard behavior, not one of those "recoverable errors" where some processors will report an error and others recover from it. You can combine the two xsl:copy-of instructions into <xsl:copy-of select="$definition/@*, @*"/> Michael Kay http://www.saxonica.com/
Current Thread |
---|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Copy Attribute Unless, Alan | Thread | [xsl] [Announcement] org.apache.for, Thorsten Scherler |
Re: [xsl] how red ampersand from th, henry human | Date | Re: [xsl] how red ampersand from th, Joe Fawcett |
Month |