This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: How to copy xml which attributes are processed with normalize-space function
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] How to copy xml which attributes are processed with normalize-space function
- From: Oliver Becker <obecker at informatik dot hu-berlin dot de>
- Date: Thu, 19 Apr 2001 10:31:34 +0200 (MET DST)
- Reply-To: xsl-list at lists dot mulberrytech dot com
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@informatik.hu-berlin.de |
| op|qo WWW: http://www.informatik.hu-berlin.de/~obecker |
\-------------------------------------------------------------------/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list