Subject: Re: [xsl] Copying Groups of Attributes From: Oliver Becker <obecker@xxxxxxxxxxxxxxxxxxxxxxx> Date: Mon, 12 Feb 2001 17:46:02 +0100 (MET) |
Hi Ciaran, > (At the moment) In my XSL if I want to copy across attributes only if they > exist <xsl:copy-of select="@*" /> Or am I thinking too simple? > I have > the following template: > > <xsl:template match="p"> > <p> > <xsl:if test="@id"> > <xsl:attribute name="align"><xsl:value-of select="@id"/></xsl:attribute> > </xsl:if> > <xsl:if test="@class"> > <xsl:attribute name="align"><xsl:value-of > select="@class"/></xsl:attribute> > </xsl:if> > ....... and so on for the rest of the attributes > </p> > </xsl:template> Well, I don't understand why you're creating align attributes ... A typo? If explicitely want to copy only certain attributes, then you could use something like <xsl:copy-of select="@id | @class" /> Excluding attributes is a little bit trickier <xsl:copy-of select="@*[name()!='unwanted' and name()!='dislike']" /> (Assuming you don't have prefixed attributes in a different namespace.) Hope that helps, Oliver /-------------------------------------------------------------------\ | ob|do Dipl.Inf. Oliver Becker | | --+-- E-Mail: obecker@xxxxxxxxxxxxxxxxxxxxxxx | | op|qo WWW: http://www.informatik.hu-berlin.de/~obecker | \-------------------------------------------------------------------/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Passing parameters to XSL, Chris Gow | Thread | [xsl] Copying Groups of Attributes, Ciaran Byrne |
Re: [xsl] International Characters , Francois Lachance | Date | [xsl] convert a string to xslt file, anand awasthi |
Month |