[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: How to copy xml which attributes are processed wit
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
|
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
|