[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

Subject: Re: 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)
attributes are processed
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.