|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Copying Groups of Attributes
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








