Subject: Re: [xsl] How to copy xml which attributes are processed with normalize-space function From: Oliver Becker <obecker@xxxxxxxxxxxxxxxxxxxxxxx> Date: Thu, 19 Apr 2001 10:31:34 +0200 (MET DST) |
Hi, > A pieces of xml is constructed from a series of **list** elements such as: > > <list a="a0 " b=" b0"/> > <list a="a1 " b="b1 "/> > .. > > The attributes **a** and **b** are processed with normalize-space function > to squeeze out the white-space before taking further transformation > actions. > > I have difficulty to get copy-of, normalize-space, attribute work together > and need your help. Have you tried the following: <xsl:template match="list"> <xsl:copy> <xsl:for-each select="@*"> <xsl:attribute name="{name()}"> <!-- if you have prefixes attributes like xlink:href, you need to add namespace="{namespace-uri()}" --> <xsl:value-of select="normalize-space()" /> </xsl:attribute> </xsl:for-each> <!-- xsl:apply-templates if your list elements have children to be processed --> </xsl:copy> </xsl:template> Cheers, 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] How to copy xml which att, Michael Kay | Thread | [xsl] Transform min and max values , Michael Strasser |
Re: [xsl] How to copy xml which att, David Carlisle | Date | AW: [xsl] how can I compare two xml, Mengel Andre (FV/SLM |
Month |